package com.ss.android.article.base.feature.detail2.picgroup;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.bytedance.article.common.c.JSONObjectWrapper;
import com.bytedance.article.common.c.TTUtils;
import com.bytedance.common.b.UserAgentCompat;
import com.bytedance.common.b.WebViewPauseResumeCompat;
import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.NetworkType;
import com.bytedance.common.utility.UIUtils;
import com.bytedance.common.utility.c.SharedPreferenceCompat;
import com.bytedance.common.utility.collection.WeakHandler;
import com.ss.android.account.Spipe;
import com.ss.android.account.c.QZone;
import com.ss.android.action.a.a.Comment;
import com.ss.android.action.a.c.ShareDialog;
import com.ss.android.action.ArticleActionHelper;
import com.ss.android.action.b.ImpressionHelper;
import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.feature.app.b.DBHelper;
import com.ss.android.article.base.feature.app.d.ImpressionListAdapter;
import com.ss.android.article.base.feature.app.e.TTAndroidObject;
import com.ss.android.article.base.feature.detail.model.ArticleDetail;
import com.ss.android.article.base.feature.detail.model.ArticleInfo;
import com.ss.android.article.base.feature.detail.model.CommentWrapper;
import com.ss.android.article.base.feature.detail.model.ImageRecom;
import com.ss.android.article.base.feature.detail.presenter.ActivityStackManager;
import com.ss.android.article.base.feature.detail.presenter.ActivityStackManager.Type;
import com.ss.android.article.base.feature.detail.presenter.CommentTabCache;
import com.ss.android.article.base.feature.detail.presenter.DetailHelper;
import com.ss.android.article.base.feature.detail.presenter.DetailLoader;
import com.ss.android.article.base.feature.detail.presenter.ArticleTabComment;
import com.ss.android.article.base.feature.detail.presenter.CommentFetcher;
import com.ss.android.article.base.feature.detail.presenter.ArticleTabCommentsRequestTask;
import com.ss.android.article.base.feature.detail.view.MyWebViewClient;
import com.ss.android.article.base.feature.detail.view.MyWebViewClientV11;
import com.ss.android.article.base.feature.detail.view.DetailWebChromeClient;
import com.ss.android.article.base.feature.detail.view.SaveImageBottomDialog;
import com.ss.android.article.base.feature.detail2.b.NewDetailAdapter;
import com.ss.android.article.base.feature.detail2.c.NewArticleDetailTTAndroidObject;
import com.ss.android.article.base.feature.detail2.c.NewArticleDetailTTAndroidObject.StatusListener;
import com.ss.android.article.base.feature.detail2.SSPage;
import com.ss.android.article.base.feature.detail2.event.TitleBarAdEvent;
import com.ss.android.article.base.feature.detail2.ArticleDetailWebPage;
import com.ss.android.article.base.feature.detail2.picgroup.view.PictureDetailLayout;
import com.ss.android.article.base.feature.detail2.view.NewDetailActivity;
import com.ss.android.article.base.feature.detail2.widget.DetailStyle;
import com.ss.android.article.base.feature.detail2.widget.DetailTitleBar;
import com.ss.android.article.base.feature.detail2.widget.a.DetailAdTextLinkLayout;
import com.ss.android.article.base.feature.e.ArticleShareHelper;
import com.ss.android.article.base.feature.feed.FeedTab;
import com.ss.android.article.base.feature.model.CellRef;
import com.ss.android.article.base.feature.model.Article;
import com.ss.android.article.base.feature.model.MediaInfo;
import com.ss.android.article.base.feature.pgc.PgcActivity;
import com.ss.android.article.base.feature.splash.SplashAdActivity;
import com.ss.android.article.base.feature.update.b.UpdateItemMgr;
import com.ss.android.article.base.feature.video.IVideoFullscreen;
import com.ss.android.article.base.feature.video.MediaHelper;
import com.ss.android.article.base.ui.LoadingFlashView;
import com.ss.android.article.base.ui.NoDataViewFactory$ImgType;
import com.ss.android.article.base.ui.SwipeBackLayout;
import com.ss.android.article.base.ui.ScrollListenerWebView;
import com.ss.android.article.base.ui.DiggAnimationView;
import com.ss.android.article.base.utils.ArticleHelper;
import com.ss.android.b.a.AdsAppItem;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.common.callback.CallbackCenter;
import com.ss.android.common.callback.SSCallback;
import com.ss.android.common.app.IComponent;
import com.ss.android.common.app.LifeCycleMonitor;
import com.ss.android.common.app.WebViewTweaker;
import com.ss.android.common.app.AbsFragment;
import com.ss.android.common.applog.AppLog;
import com.ss.android.common.dialog.AlertDialog;
import com.ss.android.common.util.LoadUrlUtils;
import com.ss.android.common.util.NetworkUtils;
import com.ss.android.image.BaseImageManager;
import com.ss.android.messagebus.SubscriptionRouter;
import com.ss.android.model.BaseArticle;
import com.ss.android.model.ItemType;
import com.ss.android.model.AbsArticle;
import com.ss.android.newmedia.BaseAppData;
import com.ss.android.newmedia.MediaAppUtil;
import com.ss.android.newmedia.a.AdsAppBaseActivity;
import com.ss.android.newmedia.a.TimeFormatter;
import com.ss.android.newmedia.a.AbstractFooter;
import com.ss.android.newmedia.e.JsObject;
import com.ss.android.newmedia.e.ShareHelper;
import com.ss.android.newmedia.e.WapStatHelper;
import com.ss.android.newmedia.f.Response;
import com.ss.android.newmedia.util.AppUtil;
import com.ss.android.newmedia.util.InfoLRUCache;
import com.ss.android.newmedia.webview.SSWebSettings;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class GalleryFragment extends AbsFragment implements
        WeakHandler.Callback,
        ShareDialog.b$a,
        com.ss.android.article.base.feature.detail.presenter.a,
        DetailHelper.SimpleArticle,
        DetailLoader.Callback,
        NewDetailAdapter.a$a,
        StatusListener,
        com.ss.android.article.base.feature.detail2.dd,
        SSPage,
        ArticleDetailWebPage,
        PictureDetailLayout.PictureDetailLayout$b,
        DetailTitleBar.OnUserAvatarClickListener,
        JsObject.ContextDataProvider {
    static final class a$a {
        public String mUrl;
        public int mMaxScrollHeight;
        public int c;

        a$a(byte arg1) {
            this();
        }

        private a$a() {

            this.c = 0;
        }

        public final String toString() {
            return "url = " + this.mUrl + ", screencount = 0, precentage = 0.0, maxscrollheight = " + this.mMaxScrollHeight;
        }
    }

    static final class a$b {
        int a;
        ImpressionListAdapter b;

        a$b() {

        }
    }

    final class a$c extends AbstractFooter {
        private final GalleryFragment j;

        public a$c(GalleryFragment arg1, View arg2) {
            super(arg2);
            this.j = arg1;
        }

        public final void onUserClick() {
            if (this.j.i != null) {
                this.j.a(this.j.b, this.j.i);
                this.j.H();
            }
        }

        public final void switchToLoading() {
            super.switchToLoading();
            GalleryFragment v0 = this.j;
            if (v0.q != null) {
                v0.q.setVisibility(View.GONE);
            }
        }
    }

    private long A;
    private int B;
    private int C;
    private int D;
    private long E;
    private long F;
    private String G;
    private String H;
    private ArticleDetail I;
    private int J;
    private int K;
    private String L;
    private boolean M;
    private Resources N;
    private DBHelper O;
    private DiggAnimationView P;
    private FrameLayout Q;
    private boolean R;
    private ArticleActionHelper S;
    private boolean T;
    private boolean U;
    private boolean V;
    private String W;
    private int X;
    private String Y;
    private String Z;
    long a;
    private boolean aA;
    private int aB;
    private boolean aC;
    private boolean aD;
    private ArrayList aE;
    private Response aF;
    private View.OnClickListener aG;
    private String aH;
    private JSONObject aI;
    private final Map aJ;
    private final Map aK;
    private ImpressionListAdapter aL;
    private long aa;
    private long ab;
    private boolean ac;
    private boolean ad;
    private boolean ae;
    private boolean af;
    private boolean ag;
    private boolean ah;
    private String ai;
    private String aj;
    private boolean ak;
    private boolean al;
    private QZone.a$a am;
    private SSCallback addArticleCommentFromUpdateCallback;
    private int ao;
    private LayoutInflater ap;
    private MyWebViewClient aq;
    private DetailWebChromeClient ar;
    private String as;
    private String at;
    private int au;
    private Comment av;
    private InfoLRUCache aw;
    private InfoLRUCache ax;
    private DetailLoader mDetailLoader;
    private NewArticleDetailTTAndroidObject mNewArticleDetailTTAndroidObject;
    long b;
    Article c;
    AppData d;
    ViewGroup e;
    boolean f;
    int g;
    View h;
    public com.ss.android.article.base.feature.detail2.picgroup.a.a i;
    protected Spipe j;
    final WeakHandler k;
    DetailHelper l;
    boolean m;
    boolean n;
    protected Context o;
    int p;
    com.ss.android.article.base.ui.NoNetView q;
    private static String TAG = GalleryFragment.class.getSimpleName();
    private ArticleShareHelper s;
    private long t;
    private BaseArticle u;
    private long v;
    private boolean w;
    private boolean mHasAppendRecomAdAndRelatedGallery;
    private String y;
    private boolean z;

    public GalleryFragment() {
        this.t = 0;
        this.v = 0;
        this.mHasAppendRecomAdAndRelatedGallery = false;
        this.C = 0;
        this.D = -1;
        this.F = 0;
        this.J = 0;
        this.M = false;
        this.g = 2147483647;
        this.T = true;
        this.U = false;
        this.V = false;
        this.W = null;
        this.X = 1;
        this.Y = null;
        this.Z = null;
        this.aa = 0;
        this.ab = 0;
        this.ac = false;
        this.ad = false;
        this.ae = false;
        this.af = false;
        this.ag = false;
        this.ah = false;
        this.ai = null;
        this.k = new WeakHandler(((WeakHandler.Callback) this));
        this.al = false;
        this.am = new com.ss.android.article.base.feature.detail2.picgroup.b(this);
        this.addArticleCommentFromUpdateCallback = new n(this);
        this.ao = 0;
        this.as = null;
        this.av = null;
        this.aA = false;
        this.aB = 0;
        this.aC = false;
        this.aD = false;
        this.aE = new ArrayList();
        this.aG = new r(this);
        this.aJ = new HashMap();
        this.aK = new HashMap();
    }

    public final void onUserClickCloseBtn() {
    }

    public final void onInfoBackClick() {
    }

    public final void onWriteCommentClick() {
        if (e(this.i)) {
            this.i.j.w = true;
            this.a("write_button", this.b, this.a);
            if (this.j != null) {
                this.M();
            }
        }
    }

    public final void onCommentLayoutClick() {
        this.a("comment_button", this.b, this.a);
        this.M();
        if (this.c != null && this.c.commentCount == 0) {
            this.e.postDelayed(new m(this), 200);
        }
    }

    public final void onFavorBtnClick() {
        if (this.c != null) {
            this.s();
        }

        if ((this.d.j()) && !((NewDetailActivity) this.getActivity()).mDetailToolBar.mActionFavorIv.isSelected()) {
            this.a(this.o, 2);
        }
    }

    public final void onShare() {
        JSONObject v0 = this.U();
        if (v0 == null) {
            v0 = new JSONObject();
        }

        JSONObject v1 = this.R();
        try {
            v0.put("location", v1.optString("location"));
            v0.put("item_id", v1.optString("item_id"));
        } catch (JSONException jsonException) {
            jsonException.printStackTrace();
        }

        this.s.mExtJsonObj = v0;
        if (this.d.getAbSettings().isQQTopShare()) {
            this.b(true);
        } else {
            this.b(false);
        }
    }

    public final void onUserAvatarClick() {
        ArticleInfo v0 = this.i.g.mArticleInfo;
        MediaInfo v0_1 = v0 != null ? v0.mMediaInfo : null;
        if (v0_1 != null && v0_1.id > 0) {
            PgcActivity.startActivity(this.getContext(), v0_1.id, this.c.itemId, "gallery_article_top_author");
        }
    }

    final void H() {
        long v6 = 0;
        com.ss.android.article.base.feature.detail2.picgroup.a.a v0 = this.i;
        if (v0 != null) {
            Article v3 = this.c;
            if (v3 == null) {
                v0.mFooter.hideFooterContent();
            } else {
                boolean v1 = v0.n;
                v0.n = true;
                CommentTabCache v8 = this.a(v3.groupId, v0);
                if (!v8.load[0]) {
                    ArticleTabComment v2 = v8.mArticleTabComments[0];
                    if (!v2.hasComment) {
                        if (NetworkUtils.isNetworkAvailable(this.o)) {
                            CommentFetcher v1_1 = new CommentFetcher(v8.mArticleTabComments[0].increateCounter(), ((AbsArticle) v3), 0, 0, v6);
                            this.mDetailLoader.loadComment(v1_1.getItemKey(), v1_1);
                            v8.load[0] = true;
                            v0.mFooter.switchToLoading();
                            this.a(v6);
                        } else {
                            this.X();
                        }
                    } else if (v3.groupId != v8.itemId) {
                        v0.mFooter.hideFooterContent();
                    } else {
                        if (!v1 && (v0.mNewDetailAdapter.hasComments())) {
                            this.a(v0, v8);
                            if (!v0.r) {
                                v0.r = true;
                                this.a("enter_comment", ((BaseArticle) v3), this.a);
                            } else {
                            }

                            return;
                        }

                        if (v2.isEmpty()) {
                            v0.mFooter.hideFooterContent();
                            return;
                        }

                        if (v8.load[0]) {
                            v0.mFooter.switchToLoading();
                            return;
                        }

                        if (!NetworkUtils.isNetworkAvailable(this.o)) {
                            this.X();
                            return;
                        }

                        MobClickCombiner.onEvent(this.getContext(), "detail", "comment_loadmore");
                        v8.load[0] = true;
                        v0.mFooter.switchToLoading();
                        new ArticleTabCommentsRequestTask(this.o, this.k, new CommentFetcher(v2.increateCounter(), ((AbsArticle) v3), 0, v2.offset, v6)).start();
                        if (v0.s) {
                            return;
                        }

                        v0.s = true;
                        this.a("finish_comment", ((BaseArticle) v3), this.a);
                    }
                }
            }
        }
    }

    final a$a I() {
        Object v0_1;
        a$a v0;
        String v1 = this.Y();
        if (v1 == null) {
            v0_1 = null;
        } else {
            v0_1 = this.aK.get(v1);
            if (v0_1 == null) {
                v0 = new a$a((byte) 0);
                v0.mUrl = v1;
                v0.c = this.aK.size();
                this.aK.put(v1, v0);
            }
        }

        return ((a$a) v0_1);
    }

    private boolean J() {
        boolean v0;
        long v6 = 0;
        Bundle v2 = this.getArguments();
        if (v2 == null) {
            v0 = false;
            return v0;
        }

        this.c = ((NewDetailActivity) this.getActivity()).getArticle2();
        if (this.c != null && this.c.groupId > v6) {
            this.d.a(this.c);
        }

        if (this.c == null) {
            return false;
        }

        this.af = v2.getBoolean("bundle_no_hw_acceleration", false);
        this.ae = v2.getBoolean("from_notification", false);
        this.Y = v2.getString("gd_ext_json");
        this.L = v2.getString("category");
        this.Z = v2.getString("enter_from");
        v0 = v2.getBoolean("view_comments", false);
        this.U = v2.getBoolean("is_jump_comment", false);
        this.V = v2.getBoolean("show_write_comment_dialog", false);
        this.aH = v2.getString("growth_from");
        if (v2.containsKey("detail_source")) {
            this.W = v2.getString("detail_source");
        } else if (this.ae) {
            this.W = "click_apn";
        }

        if (v2.containsKey("stay_tt")) {
            this.X = v2.getInt("stay_tt");
            if (this.X == 0) {
                v2.getInt("previous_task_id");
                v2.getString("previous_task_intent");
            }
        }

        v2.getBoolean("is_ugc_style");
        this.w = v2.getBoolean("view_single_id", false);
        this.b = this.c.groupId;
        this.A = this.c.itemId;
        this.B = this.c.aggrType;
        this.C = this.c.groupFlags;
        this.D = this.c.articleType;
        this.a = v2.getLong("ad_id", v6);
        this.y = v2.getString("bundle_download_app_extra");
        this.z = v2.getBoolean("bundle_forbid_jump", false);
        if (!android.support.design.a.isTextEmpty(this.Y)) {
            try {
                JSONObject v3_1 = new JSONObject(this.Y);
                this.G = v3_1.optString("source");
                this.H = v3_1.optString("query");
                this.F = v3_1.optLong("search_result_id");
            } catch (JSONException v3) {
            }
        }

        if (this.w) {
            this.E = v2.getLong("from_gid", v6);
            if (this.a > v6) {
                this.aj = v2.getString("article_url");
            }
        } else {
            this.K = v2.getInt("list_type", 0);
            if (this.i != null && this.i.mNewDetailAdapter != null) {
                this.i.mNewDetailAdapter.mAdId = this.a;
            }

            if (!v0) {
                return true;
            }

            if (this.c == null) {
                return true;
            }

            this.aa = this.c.groupId;
            if (this.c.comment == null) {
                return true;
            }

            this.ab = this.c.comment.commentId;
        }

        return true;
    }

    private void K() {
        JSONObject v0_2;
        JSONObject v6;
        String v8 = null;
        long v10 = 0;
        if (this.u != null && this.u.groupId > v10 && this.t > v10) {
            long v4 = System.currentTimeMillis() - this.t;
            if (v4 <= 3000) {
                return;
            }

            if (this.v > v10) {
                try {
                    v6 = new JSONObject("{\"ad_id\":" + this.v + "}");
                } catch (Exception v0) {
                    v6 = ((JSONObject) null);
                }
            } else {
                v6 = ((JSONObject) null);
            }

            if (AppData.getInstance().getAbSettings().isAppLogOld()) {
                this.a("stay_page", this.u, v4, v6);
            }

            if (AppData.getInstance().getAbSettings().isAppLogNew()) {
                if (v6 == null) {
                    try {
                        v0_2 = new JSONObject();
                        v0_2.put("stay_time", v4);
                    } catch (JSONException v0_1) {
                        v0_2 = v6;
                    }
                } else {
                    v0_2 = v6;
                }
                this.a("stay_page", v0_2, this.u);
            }

            if (this.i != null && this.a > v10) {
                JSONObject v9 = new JSONObject();
                try {
                    v9.put("log_extra", this.y);
                } catch (JSONException v0_1) {
                    v0_1.printStackTrace();
                }

                WapStatHelper.a(this.getActivity(), v4, this.a, v8, v9);
            }

            if (this.v > v10) {
                this.a("stay_page2", this.u, this.v);
            }
        }
    }

    public final boolean L() {
        return this.m;
    }

    private void M() {
        if ((e(this.i)) && this.i.mListView != null && !this.i.j.t) {
            this.k.removeMessages(17);
            if (this.i.j.s) {
                this.i.mNewDetailAdapter.h = false;
                this.i.mNewDetailAdapter.onPause();
                com.ss.android.article.base.feature.detail2.picgroup.a.d v0 = this.i.j;
                if (v0.p == null) {
                    v0.p = AnimationUtils.loadAnimation(((NewDetailActivity) v0.a.getActivity()), com.ss.android.article.browser.R.anim.o);
                }

                if (v0.p != null) {
                    v0.p.setAnimationListener(v0.r);
                    v0.e.startAnimation(v0.p);
                }

                this.d("handle_close_drawer");
            } else {
                this.i.mNewDetailAdapter.h = true;
                this.i.mNewDetailAdapter.onResume();
                com.ss.android.article.base.feature.detail2.picgroup.a.d v1 = this.i.j;
                if (this == null) {
                    return;
                }

                if (v1.b == null) {
                    return;
                }

                if (v1.o == null) {
                    v1.o = AnimationUtils.loadAnimation(v1.a.getActivity(), com.ss.android.article.browser.R.anim.n);
                }

                UIUtils.setVisibility(v1.e, 0);
                ((NewDetailActivity) v1.a.getActivity()).setDetailTitleBarVisible(false);
                ((NewDetailActivity) v1.a.getActivity()).setDetailToolBarVisible(false);
                if (v1.o == null) {
                    return;
                }

                v1.o.setAnimationListener(v1.q);
                v1.e.startAnimation(v1.o);
            }
        }
    }

    private void N() {
        if ((this.ak) && !this.c.ignoreWebTransform) {
            this.c.articleType = 1;
            this.ak = false;
        }
    }

    private int O() {
        int v0;
        int v1 = 0;
        int v2 = this.ao - UIUtils.getStatusBarHeight(this.o);
        if (this.o()) {
            v0 = 0;
        } else if (((NewDetailActivity) this.getActivity()).mDetailTitleBar.getVisibility() == View.VISIBLE) {
            v0 = ((NewDetailActivity) this.getActivity()).getDetailTitleBarHeight();
        } else {
            v0 = 0;
        }

        v2 -= v0;
        if (!this.o() && ((NewDetailActivity) this.getActivity()).mDetailToolBar.getVisibility() == View.VISIBLE) {
            FragmentActivity v0_1 = this.getActivity();
            if (((NewDetailActivity) v0_1).mDetailToolBar != null && ((NewDetailActivity) v0_1).mDetailToolBar.getVisibility() == View.VISIBLE) {
                v1 = ((NewDetailActivity) v0_1).mDetailToolBar.getHeight();
            }
        }

        return v2 - v1;
    }

    private int P() {
        int v0 = this.i == null || this.i.mScrollListenerWebView == null ? 0 : ((int) (UserAgentCompat.getScale(this.i.mScrollListenerWebView) * (((float) this.i.mScrollListenerWebView.getContentHeight()))));
        return v0;
    }

    private void Q() {
        int v2 = View.INVISIBLE;
        int v1 = 0;
        int v0 = 1;
        com.ss.android.article.base.feature.detail2.picgroup.a.a v3 = this.i;
        if (v3 != null && v3.e != null) {
            if (!v3.m) {
                v3.e.setVisibility(v2);
            } else {
                Article v4 = this.c;
                if (v4 != null) {
                    if (v4.hasArticleUrl()) {
                        if (v3.p) {
                            if (!v4.d()) {
                            } else {
                                v0 = 0;
                            }
                        } else if (!v4.d()) {
                        } else {
                            v0 = 0;
                        }
                    } else {
                        v0 = 0;
                    }
                }

                View v3_1 = v3.e;
                if (v0 == 0) {
                    v1 = v2;
                }

                v3_1.setVisibility(v1);
            }
        }
    }

    private JSONObject R() {
        boolean v0 = false;
        if ((this.x()) && (this.c(this.i))) {
            v0 = this.i.j.v;
        }

        if ((this.w()) && (this.b(this.i))) {
            v0 = this.i.j.k.l;
        }

        if (this.aI == null) {
            this.aI = new JSONObject();
        }

        try {
            JSONObject v1 = this.aI;
            String v2 = "location";
            String v0_2 = v0 ? "related" : "content";
            v1.put(v2, v0_2);
            this.aI.put("item_id", this.A);
        } catch (JSONException v0_1) {
        }

        return this.aI;
    }

    private String S() {
        String v0 = this.W;
        if (android.support.design.a.isTextEmpty(v0)) {
            if (this.K == 1) {
                if ("__all__".equals(this.L)) {
                    v0 = "headline";
                } else if (!android.support.design.a.isTextEmpty(this.L)) {
                    v0 = this.L;
                }
            } else if (this.K == 3) {
                v0 = "search";
            } else if (this.K == 4) {
                v0 = "pgc_list";
            } else if (this.K == 2) {
                v0 = "favorite";
            } else if (this.K == 8) {
                v0 = "read_history";
            } else if (this.K == 9) {
                v0 = "push_history";
            } else if (this.K == 10) {
                v0 = "refresh_history";
            } else {
                v0 = "";
            }
        }

        return v0;
    }

    private String T() {
        String v0 = this.W;
        if (android.support.design.a.isTextEmpty(v0)) {
            if (this.K == 1) {
                if ("__all__".equals(this.L)) {
                    v0 = "click_headline";
                } else if (!android.support.design.a.isTextEmpty(this.L)) {
                    v0 = "click_" + this.L;
                }
            } else if (this.K == 3) {
                v0 = "click_search";
            } else if (this.K == 4) {
                v0 = "click_pgc_list";
            } else if (this.K == 2) {
                v0 = "click_favorite";
            } else if (this.K == 8) {
                v0 = "click_read_history";
            } else if (this.K == 9) {
                v0 = "click_push_history";
            } else if (this.K == 10) {
                v0 = "click_refresh_history";
            }
        }

        return v0;
    }

    private JSONObject U() {
        JSONObject v1_2;
        JSONObject v0 = null;
        try {
            if (android.support.design.a.isTextEmpty(this.Y)) {

            } else {
                v0 = new JSONObject(this.Y);
            }

            if (this.E > 0) {
                if (v0 == null) {
                    v0 = new JSONObject();
                }

                v0.put("from_gid", this.E);
            }

            if (v0 == null) {
                v1_2 = new JSONObject();
                v1_2.put("log_pb", ((NewDetailActivity) this.getActivity()).getNewDetailContext().logPb);
                v0 = v1_2;
            }
            if (this.L != null) {
                v0.put("category_name", this.L);
            }

            if (this.c == null) {
                return v0;
            }
            v0.put("user_id", this.c.getUserId());
        } catch (JSONException v1) {
        }

        return v0;
    }

    private void V() {
        int v1 = 8;
        if (this.i != null) {
            UIUtils.setVisibility(this.i.mScrollListenerWebView, v1);
            UIUtils.setVisibility(this.i.mLoadingFlashView, v1);
            UIUtils.setVisibility(this.i.e, v1);
            UIUtils.setVisibility(this.i.mSwipeBackLayout, v1);
            if (this.x()) {
                UIUtils.setVisibility(this.i.mScrollListenerWebView, 0);
                this.c(this.i);
                this.i.j.a(true);
            } else {
                this.b(this.i);
                this.i.j.a(false);
            }
        }
    }

    private void W() {
        if ((this.d.getAbSettings().isSwipeBackEnabled()) && !this.d.mPicSwipeBackGuide && !this.o() && this.h == null) {
            ViewGroup v0 = ((NewDetailActivity) this.getActivity()).mRoot;
            if (v0 != null && v0.getHeight() > 0) {
                AppData v1 = this.d;
                v1.mPicSwipeBackGuide = true;
                SharedPreferences.Editor v1_1 = v1.mContext.getSharedPreferences("app_setting", 0).edit();
                v1_1.putBoolean("pic_swipe_back_guide", true);
                SharedPreferenceCompat.commit(v1_1);
                this.h = LayoutInflater.from(this.o).inflate(com.ss.android.article.browser.R.layout.g_, v0, false);
                v0.addView(this.h);
                this.h.setY(((float) (-v0.getHeight())));
                this.h.animate().y(0f).setDuration(300).setInterpolator(new DecelerateInterpolator());
                this.h.postDelayed(new com.ss.android.article.base.feature.detail2.picgroup.i(this), 2300);
            }
        }
    }

    private void X() {
        if (this.i != null && this.i.mFooter != null && this.i.mFooter.mFooterContent != null && !NetworkUtils.isNetworkAvailable(this.getContext())) {
            if (this.q == null) {
                this.q = android.support.design.a.a(this.getContext(), this.i.mFooter.mFooterContent, com.ss.android.article.base.ui.ac.a(NoDataViewFactory$ImgType.NOT_NETWORK), com.ss.android.article.base.ui.ad.a(this.getString(com.ss.android.article.browser.R.string.not_network_tip)), com.ss.android.article.base.ui.ab.a(new com.ss.android.article.base.ui.aa(this.getString(com.ss.android.article.browser.R.string.label_retry), new com.ss.android.article.base.feature.detail2.picgroup.o(this))));
            }

            this.q.initNoDataActionBtn();
            this.q.setVisibility(View.VISIBLE);
            this.i.mFooter.hide();
        }
    }

    private String Y() {
        String v0 = null;
        if (this.i != null && this.i.mScrollListenerWebView != null) {
            String v1 = this.i.mScrollListenerWebView.getOriginalUrl();
            if (!android.support.design.a.isTextEmpty(v1) && !v1.equals("about:blank")) {
                v0 = g(v1);
            }
        }

        return v0;
    }

    private void a(String arg10, BaseArticle arg11, long arg12, JSONObject arg14) {
        JSONObject v8;
        long v4 = 0;
        String v3 = this.T();
        if (!android.support.design.a.isTextEmpty(arg10)) {
            long v6 = arg11 != null ? arg11.itemId : v4;
            int v0 = arg11 != null ? arg11.aggrType : 0;
            if (arg14 == null) {
                v8 = new JSONObject();
            } else {
                v8 = arg14;
            }

            try {
                if (!v8.has("item_id")) {
                    v8.put("item_id", v6);
                }

                if (v8.has("aggr_type")) {
                } else {
                    v8.put("aggr_type", v0);
                }
            } catch (Exception v0_1) {
            }

            Context v1 = this.getContext();
            if (arg11 != null) {
                v4 = arg11.groupId;
            }

            MobClickCombiner.onEvent(v1, arg10, v3, v4, arg12, v8);
        }
    }

    private void a(String arg12, JSONObject arg13, BaseArticle arg14) {
        String v10;
        long v4 = 0;
        JSONObjectWrapper v8 = new JSONObjectWrapper();
        String v1 = this.T();
        long v6 = arg14 != null ? arg14.itemId : v4;
        int v0 = arg14 != null ? arg14.aggrType : 0;
        String v9 = "group_id";
        long v2 = arg14 != null ? arg14.groupId : v4;
        v8.put(v9, Long.valueOf(v2)).put("item_id", Long.valueOf(v6)).put("aggr_type", Integer.valueOf(v0)).put("log_pb", ((NewDetailActivity) this.getActivity()).getNewDetailContext().logPb);
        String v0_1 = this.L;
        if (android.support.design.a.isTextEmpty(v1)) {
            v10 = v1;
            v1 = v0_1;
            v0_1 = v10;
        } else if (v1.equals("click_" + this.L)) {
            v0_1 = "click_category";
            v1 = this.L;
        } else if (v1.equals("click_headline")) {
            v10 = v1;
            v1 = this.L;
            v0_1 = v10;
        } else {
            v10 = v1;
            v1 = v1.replaceFirst("click_", "");
            v0_1 = v10;
        }

        v8.put("enter_from", v0_1).put("category_name", v1);
        if (AppData.getInstance().getAbSettings().isApplogStaging()) {
            v8.put("_staging_flag", Integer.valueOf(1));
        }

        if (this.F != v4) {
            v8.put("search_result_id", Long.valueOf(this.F)).put("source", this.G).put("query", this.H);
        }

        v8.put(arg13);
        android.support.design.a.onEvent(arg12, v8.jo);
    }

    private void a(String arg8, BaseArticle arg9, long arg10) {
        this.a(arg8, arg9, arg10, null);
    }

    private String a(com.ss.android.article.base.feature.detail2.picgroup.a.a arg9, String arg10, boolean arg11) {
        Object v0_3;
        String v0;
        int v1 = 3;
        int v3 = 0;
        Object v4 = null;
        int v5 = 2;
        if (arg9 == null) {
            arg10 = "";
        } else if (!NetworkUtils.isNetworkAvailable(this.o)) {
            arg10 = "";
        } else {
            UIUtils.setVisibility(arg9.mScrollListenerWebView, 0);
            arg9.mLoadingFlashView.setVisibility(View.GONE);
            this.Q();
            arg9.mScrollListenerWebView.setTag(com.ss.android.article.browser.R.id.webview_history_key, v4);
            arg9.p = true;
            if (arg11) {
                v0 = "m";
                if (this.au == 1) {
                    v0 = "s";
                } else if (this.au == v5) {
                    v0 = "l";
                } else if (this.au == v1) {
                    v0 = "xl";
                }

                v1 = this.d.mLoadImagePref;
                NetworkType v6 = NetworkUtils.getNetworkType(this.o);
                if (v6 != NetworkType.NONE) {
                    if (v6 != NetworkType.WIFI && v1 == v5) {
                        v1 = 0;
                    } else {
                        v1 = 1;
                    }
                } else {
                    v1 = 0;
                }

                if (!AppData.isNightMode()) {
                    v3 = 1;
                }

                StringBuilder v2 = new StringBuilder(arg10);
                if (arg10 == null || arg10.indexOf(35) <= 0) {
                    v2.append("#");
                } else {
                    v2.append("&");
                }

                v2.append("tt_font=").append(v0);
                v2.append("&tt_daymode=").append(v3);
                v2.append("&tt_image=").append(v1);
                v2.append("&tt_from=app");
                if (this.x()) {
                    v2.append("&support_gallery=true");
                }

                arg10 = v2.toString();
            } else {
                ScrollListenerWebView v3_1 = arg9.mScrollListenerWebView;
                int v6_1 = this.au;
                if (v3_1 == null) {
                } else {
                    int v0_1 = v6_1 == 1 ? 1 : v5;
                    if (v6_1 == v5) {
                        v0_1 = v1;
                    }
                    if (v6_1 == v1) {
                        v0_1 = 4;
                    }
                    com.bytedance.common.b.d.a(((WebView) v3_1), v0_1);
                }
            }
            ScrollListenerWebView v1_1 = arg9.mScrollListenerWebView;
            int v2_1 = com.ss.android.article.browser.R.id.webview_support_js;
            if (arg11) {
                v0_3 = Boolean.TRUE;
            } else {
                v0_3 = v4;
            }

            v1_1.setTag(v2_1, v0_3);
            arg9.mScrollListenerWebView.setTag(com.ss.android.article.browser.R.id.webview_client_transform_key, v4);
            arg9.mScrollListenerWebView.setTag(com.ss.android.article.browser.R.id.webview_transform_key, v4);
            HashMap v1_2 = new HashMap();
            if (this.c != null) {
                v0 = this.as;
                if ((this.c.hasArticleUrl()) && (this.c.e())) {
                    v0 = this.at;
                }

                AppUtil.appendAdditionHttpHeaders(v1_2, v0, this.c.wapHeaders);
            }

            TTUtils.webViewLoadUrl(arg10, arg9.mScrollListenerWebView, v1_2);
            this.f(arg10);
            if (this.c != null) {
                this.d(this.c);
            }

            if (arg9 == null) {
                return arg10;
            }

            Article v0_4 = this.c;
            if (!this.isActive()) {
                return arg10;
            }

            if (v0_4 == null) {
                return arg10;
            }

            if (this.u == null || this.u.groupId != v0_4.groupId) {
                this.K();
                this.t = 0;
                this.u = new BaseArticle(v0_4.groupId, v0_4.itemId, v0_4.aggrType);
            }

            this.v = this.a;
            if (this.t > 0) {
                return arg10;
            }

            this.t = System.currentTimeMillis();
        }

        return arg10;
    }

    private void a(int arg2, int arg3) {
        if (!this.o()) {
            android.support.design.a.showImageToast(this.getContext(), arg3, arg2);
        }
    }

    private void a(long arg10) {
        if (this.i != null && this.i.i != null && (this.d.commentLoadMultiTab())) {
            ArticleTabComment v0 = this.i.i.mArticleTabComments[1];
            if (!v0.hasComment) {
                CommentFetcher v1 = new CommentFetcher(v0.increateCounter(), this.c, 1, 0, arg10);
                this.mDetailLoader.loadComment(v1.getItemKey(), v1);
                this.i.i.load[1] = true;
            }
        }
    }

    private void a(Context arg7, int arg8) {
        if (arg8 != 1) {
            if (arg8 != 2) {
                return;
            }

            if (this.j.isLogin) {
                return;
            }

            if (!this.d.j()) {
                return;
            }

            AlertDialog.Builder builder = com.ss.android.j.b.createDialogBuilder(this.getActivity());
            builder.setMessage(com.ss.android.article.browser.R.string.ry);
            builder.setPositiveButton(com.ss.android.article.browser.R.string.rx, new com.ss.android.article.base.feature.detail2.picgroup.g(this));
            builder.setNegativeButton(com.ss.android.article.browser.R.string.label_cancel, new com.ss.android.article.base.feature.detail2.picgroup.h(this));
            MobClickCombiner.onEvent(this.getActivity(), "auth", "login_detail_favor");
            builder.setCancelable(true);
            if (this.isViewValid()) {
                builder.show();
            }

            this.d.unloginFaverFirst = false;
        } else if (!this.j.isLogin && (this.d.l())) {
            com.ss.android.article.base.feature.detail2.picgroup.f v1 = new com.ss.android.article.base.feature.detail2.picgroup.f(this);
            com.ss.android.article.base.feature.app.bb v0 = null;
            if (arg8 == 1) {
                v0 = new com.ss.android.article.base.feature.app.bb(arg7, "login_detail_comment");
                v0.a(0, com.ss.android.article.browser.R.string.rv, com.ss.android.article.browser.R.string.rt);
                v0.a(com.ss.android.article.browser.R.string.rs, v1);
            } else if (arg8 == 2) {
                v0 = new com.ss.android.article.base.feature.app.bb(arg7, "login_detail_favor");
                v0.a(com.ss.android.article.browser.R.drawable.nq, com.ss.android.article.browser.R.string.rw, com.ss.android.article.browser.R.string.ru);
                v0.a(com.ss.android.article.browser.R.string.rr, v1);
            }

            if (v0 != null && arg7 != null && (this.isViewValid())) {
                v0.show();
                this.d.unloginFaverFirst = false;
            }

            this.d.a(System.currentTimeMillis());
            this.d.m();
        }
    }

    private void a(ArticleDetail arg9) {
        boolean v1 = true;
        if (arg9 != null) {
            this.I = arg9;
            if (!arg9.delete) {
            } else if (!this.o()) {
                ((NewDetailActivity) this.getActivity()).switchToArticleDeleted(this.c);
                return;
            }
        }
        if (this.a > 0 && !android.support.design.a.isTextEmpty(this.aj)) {
            this.c.articleUrl = this.aj;
        }

        if (this.i != null) {
            this.a(this.c, this.i.mScrollListenerWebView);
        }

        this.e(this.c);
        this.C = this.c.groupFlags;
        this.D = this.c.articleType;
        if (this.s != null) {
            this.s.mShareSource = 208;
        }

        if (!this.aD && this.i != null) {
            this.b(this.i);
            this.i.j.c();
        }

        this.aD = true;
        this.V();
        if ((this.w()) && (this.b(this.i))) {
            this.i.j.k.setCallback(this);
            this.i.j.k.a(false);
            if (arg9 != null && (arg9.hasGalleryImages())) {
                if (this.c.y == null) {
                    this.c.y = new ArrayList();
                }

                this.c.y.clear();
                this.c.y.addAll(arg9.galleryImageInfoList);
                UIUtils.setVisibility(this.i.j.k, 0);
                this.i.j.k.setOriginal(this.I.isOriginal);
                PictureDetailLayout v0 = this.i.j.k;
                Article v3 = this.c;
                if (v3 != null) {
                    v0.e = v3;
                    if (v0.d == null) {
                        v0.d = new com.ss.android.article.base.feature.detail2.picgroup.view.PictureDetailLayout.a(v0, v0.f, v3);
                        v0.b.setAdapter(v0.d);
                        v0.b.setPageTransformer(false, new com.ss.android.article.base.feature.detail2.picgroup.view.b());
                        v0.b.addOnPageChangeListener(new com.ss.android.article.base.feature.detail2.picgroup.view.c(v0));
                    } else {
                        com.ss.android.article.base.feature.detail2.picgroup.view.PictureDetailLayout.a v4 = v0.d;
                        if (v3 != null) {
                            if (v3.o()) {
                                v4.b.clear();
                                v4.b.addAll(v3.y);
                                v4.f.k = v4.b.size();
                            }

                            v4.notifyDataSetChanged();
                        }
                    }

                    v0.a();
                    if (!UIUtils.isVisible(v0.h)) {
                        v0.b();
                    }

                    v0.setBottomLayoutVisibility(0);
                    if (!v0.f.isViewValid()) {
                    } else {
                        v0.f.setCommentCount(v3.commentCount);
                        v0.f.setFavorIconSelected(v3.userRepin);
                    }
                }

                this.i.j.k.c(false);
                if (this.o()) {

                } else {
                    if (!this.ak) {
                        ((NewDetailActivity) this.getActivity()).setUserAvatar(this.I.avatarUrl);
                        if ((android.support.design.a.isTextEmpty(this.I.avatarUrl)) || !this.I.userVerified) {
                            v1 = false;
                        }
                        ((NewDetailActivity) this.getActivity()).e(v1);
                    }

                    if (!this.ak) {

                    } else {
                        ((NewDetailActivity) this.getActivity()).setDetailStyle(DetailStyle.NATIVE_PICGROUP_STYLE);
                    }
                }
            } else {
                this.i.j.k.c(true);
            }
        }

        label_155:
        this.N();
    }

    private void a(Article arg3, WebView arg4) {
        if (arg4 != null) {
            String v0 = this.as;
            if (arg3 != null && (arg3.hasArticleUrl()) && (arg3.e())) {
                v0 = this.at;
            }

            if (android.support.design.a.isTextEmpty(v0)) {
                return;
            }

            arg4.getSettings().setUserAgentString(v0);
        }
    }

    private void embedContextInfo(com.ss.android.article.base.feature.detail2.picgroup.a.a arg9, ArticleInfo arg10, boolean arg11) {
        boolean v2_1;
        boolean v0 = true;
        if (arg10 == null) {
            return;
        }

        if (arg9 == null) {
            return;
        }

        String v2 = arg10.context;
        if (!arg11 || (android.support.design.a.isTextEmpty(v2))) {
            v2_1 = false;
        } else {
            LoadUrlUtils.loadUrl(arg9.mScrollListenerWebView, "javascript:insertDiv(" + v2 + ")");
            v2_1 = true;
        }

        try {
            if (android.support.design.a.isTextEmpty(arg10.script)) {
                v0 = false;
            } else {
                LoadUrlUtils.loadUrl(arg9.mScrollListenerWebView, "javascript:" + arg10.script);
            }
        } catch (Exception v1) {
            Logger.w(TAG, "load info script exception: " + v1);
        }

        if (Logger.debug()) {
            Logger.v(TAG, "embedContextInfo " + this.b + " " + v2_1 + " " + v0);
        }
    }

    private void a(com.ss.android.article.base.feature.detail2.picgroup.a.a arg7, boolean arg8) {
        int v5 = com.ss.android.article.browser.R.color.gq;
        int v4 = com.ss.android.article.browser.R.color.article_detail_color;
        if (arg7 != null && arg7.m != arg8) {
            arg7.m = arg8;
            com.ss.android.article.base.feature.detail2.picgroup.a.b v0 = arg7.g;
            Resources v1 = v0.mActivity.getResources();
            boolean v2 = AppData.isNightMode();
            if (v0.isNightMode != v2) {
                v0.isNightMode = v2;
                if (v0.c != null) {
                    v0.c.adaptNightMode();
                }

                com.ss.android.article.base.feature.detail2.config.a.a(v0.b, v0.mActivity.getResources().getColor(v4));
                v0.mContentsWrapper.setBackgroundResource(v4);
                v0.mSofaText.setTextColor(v1.getColor(com.ss.android.article.browser.R.color.update_comment_more_text_selector));
            }

            com.ss.android.article.base.feature.detail2.config.a.a(arg7.mListView, this.o.getResources().getColor(v4));
            arg7.l.setTextColor(this.getResources().getColor(com.ss.android.article.browser.R.color.ly));
            com.ss.android.article.base.feature.detail2.config.a.a(arg7.l, this.o.getResources().getColor(com.ss.android.article.browser.R.color.qm));
            if (e(this.i)) {
                com.ss.android.article.base.feature.detail2.picgroup.a.d v0_1 = arg7.j;
                boolean v1_1 = AppData.isNightMode();
                if (v0_1.d != v1_1) {
                    v0_1.d = v1_1;
                    com.ss.android.article.base.feature.detail2.config.a.a(v0_1.g, v0_1.a.getResources().getColor(v4));
                    v0_1.h.setBackgroundResource(com.ss.android.article.browser.R.color.ssxinxian7);
                    v0_1.f.setBackgroundColor(v0_1.c.getColor(com.ss.android.article.browser.R.color.ob));
                    v0_1.j.setBackgroundResource(com.ss.android.article.browser.R.drawable.hg);
                    v0_1.j.setTextColor(v0_1.c.getColor(com.ss.android.article.browser.R.color.ssxinzi3));
                    v0_1.i.setBackgroundColor(v0_1.c.getColor(com.ss.android.article.browser.R.color.od));
                    v0_1.l.setBackgroundResource(com.ss.android.article.browser.R.drawable.detail_bg_titlebar);
                    if (v0_1.m != null) {
                        v0_1.m.setImageResource(com.ss.android.article.browser.R.drawable.btn_back);
                    }

                    if (v0_1.n == null) {
                    } else {
                        v0_1.n.setImageResource(com.ss.android.article.browser.R.drawable.c_);
                    }
                }
            }
            if (arg7.mFooter.mFooterTopDivider != null) {
                arg7.mFooter.mFooterTopDivider.setBackgroundResource(v5);
            }

            if (arg7.mFooter.mFooterBottomDivider == null) {
                return;
            }

            arg7.mFooter.mFooterBottomDivider.setBackgroundResource(v5);
        }
    }

    private void a(String arg11, long arg12, long arg14) {
        MobClickCombiner.onEvent(this.getContext(), "slide_detail", arg11, arg12, arg14, this.R());
    }

    private static void a(List<CommentWrapper> arg5) {
        if (arg5 != null && arg5.size() != 0) {
            int v1;
            for (v1 = 0; v1 < arg5.size(); ++v1) {
                Object v0 = arg5.get(v1);
                ((CommentWrapper) v0).e = 0;
                if (((CommentWrapper) v0).cellType != 1 && v1 > 0) {
                    v0 = arg5.get(v1 - 1);
                    if (((CommentWrapper) v0).cellType == 1) {
                        ((CommentWrapper) v0).e = 1;
                    }
                }

                if (v1 == arg5.size() - 1) {
                    arg5.get(v1).e = 2;
                }
            }
        }
    }

    final CommentTabCache a(long arg6, com.ss.android.article.base.feature.detail2.picgroup.a.a arg8) {
        CommentTabCache v0_1 = null;
        v0_1 = (CommentTabCache) this.ax.get(Long.valueOf(arg6));
        if (v0_1 == null) {
            v0_1 = arg8.i;
            if (v0_1 == null || arg6 != v0_1.itemId) {
                v0_1 = new CommentTabCache(arg6);
            }

            this.ax.put(Long.valueOf(arg6), v0_1);
        }
        if (arg8.i != v0_1) {
            arg8.i = v0_1;
        }

        return v0_1;
    }

    final void a(com.ss.android.article.base.feature.detail2.picgroup.a.a arg4, CommentTabCache arg5) {
        if (arg4 != null && arg5 != null) {
            if (arg5.mArticleTabComments[0].isEmpty()) {
                arg4.mFooter.hideFooterContent();
                boolean v0 = arg5.mArticleTabComments[0].banComment;
                if (!v0 && this.c != null) {
                    v0 = this.c.mBanComment;
                }

                com.ss.android.article.base.feature.detail2.picgroup.a.b v2 = arg4.g;
                v0 = !v0 ? true : false;
                v2.a(v0);
            } else {
                arg4.mFooter.setViewMoreText(com.ss.android.article.browser.R.string.ss_load_more);
                if (arg5.mArticleTabComments[0].hasMore) {
                    arg4.mFooter.switchToMoreContent();
                } else {
                    arg4.mFooter.hideFooterContent();
                }

                arg4.g.a(false);
            }

            if (arg5.load[0]) {
                arg4.mFooter.switchToLoading();
            }

            arg4.mNewDetailAdapter.addAllComment(arg5.mArticleTabComments[0].commentWrapperList);
            arg4.mNewDetailAdapter.notifyDataSetChanged();
        }
    }

    public final Response checkResponse(String arg4) {
        Response v1 = null;
        Response v0 = this.aF;
        if (arg4 == null || v0 == null || v0.originUrl == null) {
            v0 = v1;
        } else if (!AppUtil.a(arg4, v0.originUrl)) {
            v0 = v1;
        }
        return v0;
    }

    public final void a() {
        Article v0 = this.c;
        if (v0 != null) {
            String v1 = v0.userRepin ? "unfavorite_button" : "favorite_button";
            this.a(v1, this.b, this.a);
        }
    }

    public final void adImageShow(int arg14) {
        int v12 = 3;
        if (!this.c(this.i)) {
            return;
        }

        com.ss.android.article.base.feature.detail2.picgroup.a.d v10 = this.i.j;
        boolean v0 = arg14 == v12 ? true : false;
        v10.v = v0;
        if (v10.a.o()) {
            if (arg14 == v12) {
                this.W();
                this.g = 2147483647;
            }
            return;
        }

        switch (arg14) {
            case 0:
            case 1: {
                if (!v10.u || (v10.s) || (v10.t)) {
                    ((NewDetailActivity) v10.a.getActivity()).setDetailTitleBarVisible(false);
                    ((NewDetailActivity) v10.a.getActivity()).setDetailToolBarVisible(false);
                } else {
                    ((NewDetailActivity) v10.a.getActivity()).setDetailTitleBarVisible(true);
                    ((NewDetailActivity) v10.a.getActivity()).setDetailToolBarVisible(true);
                }

                v10.e();
                break;
            }
            case 2: {
                ((NewDetailActivity) v10.a.getActivity()).setDetailToolBarVisible(false);
                if (v10.D == null || v10.D.F == null || (android.support.design.a.isTextEmpty(v10.D.F.label))) {
                    ((NewDetailActivity) v10.a.getActivity()).b(v10.a.getString(com.ss.android.article.browser.R.string.ad_label_new));
                } else {
                    ((NewDetailActivity) v10.a.getActivity()).b(v10.D.F.label);
                }

                GalleryFragment v11 = v10.a;
                ImageRecom v4 = v11.i.g.mArticleInfo.F;
                if (v4 != null && !v11.al) {
                    JSONObject jsonObject = new JSONObject();
                    try {
                        jsonObject.put("log_extra", v4.logExtra);
                    } catch (JSONException jsonException) {
                        jsonException.printStackTrace();
                    }

                    if (v4.trackUrlList != null && !v4.trackUrlList.isEmpty()) {
                        AppUtil.a(v4.trackUrlList, v11.getContext());
                    }

                    MobClickCombiner.onEvent(v11.getContext(), "embeded_ad", "show", v4.id, 0, jsonObject);
                    v11.al = true;
                }

                v10.e();
                break;
            }
            case 3: {
                ((NewDetailActivity) v10.a.getActivity()).setDetailToolBarVisible(true);
                ((NewDetailActivity) v10.a.getActivity()).b(v10.a.getString(com.ss.android.article.browser.R.string.recommend_picture));
                v10.d();
                break;
            }
        }
        SubscriptionRouter.c(new TitleBarAdEvent());
        if (arg14 == v12) {
            this.W();
            this.g = 2147483647;
        }
    }

    public final void slideShow(int arg4, int arg5, int arg6) {
        if (e(this.i)) {
            com.ss.android.article.base.feature.detail2.picgroup.a.d v1 = this.i.j;
            v1.A = arg5;
            int v0 = v1.x > arg5 ? v1.x : arg5;
            v1.x = v0;
            v1.y = arg4;
            this.f = false;
            this.g = arg6 > 0 ? ((int) TypedValue.applyDimension(1, ((float) arg6), this.o.getResources().getDisplayMetrics())) : 2147483647;
            if (arg5 != arg4 - 1) {
                return;
            }

            if (this.mHasAppendRecomAdAndRelatedGallery) {
                return;
            }
            this.W();
        }
    }

    public final void onReceivedError(int errorCode, String description) {
        if (Logger.debug()) {
            Logger.v(TAG, "onReceivedError " + errorCode + " " + description);
        }

        if (!this.o()) {
            com.ss.android.article.base.feature.detail2.picgroup.a.a v0 = this.i;
            if (v0 != null) {
                v0.mWapStatHelper.onReceivedError(errorCode);
            }
        }
    }

    public final void onShowCustomView(View arg1, WebChromeClient.CustomViewCallback customViewCallback) {
    }

    public final void onDomReady(WebView webView) {
        JSONObject v6 = null;
        if (Logger.debug()) {
            Logger.d(TAG, "onDomReady");
        }

        if (!this.o() && webView != null && this.c != null && this.i != null) {
            JSONObject v0 = null;
            try {
                v6 = new JSONObject();
                v6.put("article_type", this.c.articleType);
                if (android.support.design.a.isTextEmpty(this.y)) {
                } else {
                    v6.put("log_extra", this.y);
                }
            } catch (JSONException v0_1) {
            }

            if (this.i != null && (this.c.hasArticleUrl())) {
                this.i.mWapStatHelper.onDomReady(webView, this.c, this.a, v6);
            }

            this.appendRecomAdAndRelatedGallery(this.i);
        }
    }

    public final void onProgressChanged(WebView webView, int progress) {
    }

    public final void onPageStarted(WebView webView, String url) {
        boolean v0 = true;
        if (Logger.debug()) {
            Logger.v(TAG, "onPageStarted " + url + " " + webView.getOriginalUrl());
        }

        this.mHasAppendRecomAdAndRelatedGallery = false;
        if (this.i != null) {
            this.i.o = false;
        }

        if (this.i != null && this.c != null) {
            int v2 = this.i.mScrollListenerWebView.getTag(com.ss.android.article.browser.R.id.webview_client_transform_key) == Boolean.TRUE ? 1 : 0;
            if (v2 != 0) {
                v0 = false;
            }

            if (url.startsWith("file:///android_asset/article/")) {
                this.i.mWapStatHelper.onPageStarted(webView, url, v0, url);
                return;
            }

            this.i.mWapStatHelper.onPageStarted(webView, url, v0, this.c.articleUrl);
        }
    }

    public final void a(Comment comment) {
        if (!this.o()) {
            com.ss.android.article.base.feature.detail2.picgroup.a.a v3 = this.i;
            if (v3 != null) {
                Article v4 = this.c;
                if (v4 != null && comment != null) {
                    boolean v0 = v4.groupId != comment.groupId || v4.itemId != comment.itemId ? false : true;
                    if (!v0) {
                        v0 = v4.getItemKey().equals(comment.itemKey);
                    }

                    if (!v0) {
                        return;
                    }

                    if (android.support.design.a.isTextEmpty(comment.text)) {
                        return;
                    }

                    CommentTabCache v0_1 = this.a(this.b, this.i);
                    ArticleTabComment v5 = v0_1.mArticleTabComments[0];
                    v5.commentWrapperList.add(0, CommentWrapper.fromComment(comment));
                    if (v5.totalNumber >= 0) {
                        ++v5.totalNumber;
                    }

                    ArticleTabComment v1 = v0_1.mArticleTabComments[1];
                    v1.commentWrapperList.add(0, CommentWrapper.fromComment(comment));
                    if (v1.totalNumber >= 0) {
                        ++v1.totalNumber;
                    }

                    ++v4.commentCount;
                    if (v3.i == v0_1) {
                        v3.g.a(false);
                        v3.mNewDetailAdapter.addAllComment(v5.commentWrapperList);
                        v3.mNewDetailAdapter.notifyDataSetChanged();
                        this.b(v4);
                    }

                    if (!this.w() || !this.b(this.i)) {
                        if ((this.x()) && (this.c(this.i)) && !this.o()) {
                            ((NewDetailActivity) this.getActivity()).setCommentCount(v4.commentCount);
                        }
                    } else if (!this.o()) {
                        ((NewDetailActivity) this.getActivity()).setCommentCount(v4.commentCount);
                    }

                    if (this.p <= 0) {
                        return;
                    }

                    if (this.mNewArticleDetailTTAndroidObject == null) {
                        return;
                    }

                    this.mNewArticleDetailTTAndroidObject.a(this.p, comment.commentId);
                }
            }
        }
    }

    public final void onCommentLoaded(CommentFetcher arg13, boolean arg14) {
        if (!this.o() && arg13 != null && arg13.article != null && arg13.a == this.i.i.mArticleTabComments[arg13.tabIndex].counter) {
            int v0 = arg13.tabIndex != 0 || (this.p()) ? 0 : 1;
            long v2 = arg13.article.groupId;
            long v4 = arg13.article.itemId;
            if (Logger.debug()) {
                Logger.d(TAG, "onCommentLoaded " + v2 + " " + arg13.tabIndex + " " + arg13.offset + " " + arg14);
            }

            com.ss.android.article.base.feature.detail2.picgroup.a.a v6 = this.i;
            v6.i.load[arg13.tabIndex] = false;
            if (!arg14) {
                if (v0 == 0) {
                    return;
                }

                if (arg13.errorCode == 12) {
                    this.X();
                    return;
                }

                v6.mFooter.switchToError(com.ss.android.article.browser.R.string.ss_error_unknown);
                return;
            }

            ArticleTabComment v7 = this.i.i.mArticleTabComments[arg13.tabIndex];
            if (v7.h <= 0) {
                v7.h = System.currentTimeMillis();
            }

            v7.copyAllComment(arg13.articleTabComment);
            a(v7.commentWrapperList);
            v7.offset += arg13.j;
            if (v7.commentWrapperList.isEmpty()) {
                v7.hasMore = false;
            }

            int v1 = v7.commentWrapperList.size() == 0 ? 1 : 0;
            if (v1 == 0) {
                if (v0 == 0) {
                } else if ((v7.detailNoComment) && !v6.n) {
                    v6.mFooter.setViewMoreText(com.ss.android.article.browser.R.string.label_click_to_view_comments);
                    v6.mFooter.switchToMoreContent();
                } else {
                    v6.mFooter.setViewMoreText(com.ss.android.article.browser.R.string.ss_load_more);
                    if (v7.hasMore) {
                        v6.mFooter.switchToMoreContent();
                    } else {
                        v6.mFooter.hideFooterContent();
                    }
                }
            } else if (v0 != 0) {
                v6.mFooter.hideFooterContent();
                v1 = (v7.banComment) || (arg13.article.mBanComment) ? 1 : 0;
                com.ss.android.article.base.feature.detail2.picgroup.a.b v8 = v6.g;
                boolean v1_1 = v1 == 0 ? true : false;
                v8.a(v1_1);
            }

            if (v0 != 0) {
                v1 = 0;
                if (!v7.detailNoComment || (v6.n)) {
                    v6.mNewDetailAdapter.addAllComment(v7.commentWrapperList);
                    if (arg13.topCommentId > 0) {
                        v1 = 1;
                    }
                } else {
                    v6.mNewDetailAdapter.addAllComment((List) null);
                }

                v6.mNewDetailAdapter.i = v7.goTopicDetail;
                v6.mNewDetailAdapter.notifyDataSetChanged();
                if (v1 == 0) {
                } else {
                    v1 = v6.mListView.getHeaderViewsCount();
                    try {
                        v6.mListView.setSelection(v1);
                    } catch (Exception v1_2) {
                    }
                }
            }

            if (v7.totalNumber >= 0) {
                if (v7.totalNumber < v7.commentWrapperList.size()) {
                    v7.totalNumber = v7.commentWrapperList.size();
                }

                if (arg13.article.commentCount == v7.totalNumber) {
                } else {
                    arg13.article.commentCount = v7.totalNumber;
                    DBHelper.getInstance(this.o).a(v2, v4, v7.totalNumber);
                    com.ss.android.article.base.feature.detail2.picgroup.a.a v1_3 = this.i;
                    Article v2_1 = this.c;
                    if (v1_3 == null) {
                    } else if (v2_1 == null) {
                    } else if (v2_1 != arg13.article) {
                    } else {
                        if (v7.banComment) {
                            arg13.article.mBanComment = true;
                        }

                        if (v0 == 0) {
                        } else {
                            this.b(v2_1);
                        }
                    }
                }
            }

            if (v0 != 0 && (this.U)) {
                this.U = false;
                if (!android.support.design.a.isTextEmpty(this.aH)) {
                    MobClickCombiner.onEvent(this.getContext(), "enter_comment", this.aH);
                }

                v1 = 4;
                if (this.o()) {
                } else {
                    com.ss.android.article.base.feature.detail2.picgroup.a.a v2_2 = this.i;
                    if (v2_2 == null) {
                    } else {
                        v0 = v2_2.mListView.getHeaderViewsCount();
                        Article v3 = this.c;
                        if (v3 != null && (v3.disableScrollOver())) {
                            v1 = 2;
                        }
                        switch (v1) {
                            case 4: {
                                v0 = 1;
                                break;
                            }
                        }
                        try {
                            v2_2.mListView.setSelection(v0);
                        } catch (Exception v0_1) {
                        }

                        if (v2_2.mNewDetailAdapter.h) {
                            v2_2.mNewDetailAdapter.h = false;
                        }
                        this.c("handle_open_drawer");
                    }
                }
            }

            if (this.V) {
                this.V = false;
                this.t();
            }
        }
    }

    final void a(com.ss.android.article.base.feature.detail2.picgroup.a.a arg6) {
        if (arg6 != null && arg6.g != null && !arg6.r) {
            Article v0 = this.c;
            if (v0 != null) {
                arg6.r = true;
                this.a("enter_comment", ((BaseArticle) v0), this.a);
                if (!this.d.loginCommentFirst) {
                    this.a(this.o, 1);
                }

                this.aC = true;
            }
        }
    }

    public final void onArticleInfoLoaded(Article article, ArticleInfo articleInfo) {
        int v0_1;
        String v7 = null;
        int v6 = -1;
        int v1 = 1;
        if (!this.o() && article != null && article == this.c) {
            if (articleInfo == null) {
                long v0 = article.groupId;
                if (Logger.debug()) {
                    UIUtils.showImageToast(this.o, com.ss.android.article.browser.R.drawable.close_popup_textpage, "load info failed: " + v0);
                }
            } else {
                if (Logger.debug()) {
                    Logger.d(TAG, "onArticleInfoLoaded " + articleInfo.itemId);
                }

                this.aw.put(Long.valueOf(articleInfo.itemId), articleInfo);
                this.ai = articleInfo.webViewTrackKey;
                com.ss.android.article.base.feature.detail2.picgroup.a.a v3 = this.i;
                if (v3 != null && !android.support.design.a.isTextEmpty(this.ai)) {
                    v3.mWapStatHelper.mWebViewTrackKey = this.ai;
                }

                if (articleInfo.diggCount < 0 || article.diggCount == articleInfo.diggCount) {
                    articleInfo.diggCount = v6;
                    v0_1 = 0;
                } else {
                    article.diggCount = articleInfo.diggCount;
                    v0_1 = 1;
                }

                if (articleInfo.buryCount < 0 || article.buryCount == articleInfo.buryCount) {
                    articleInfo.buryCount = v6;
                } else {
                    article.buryCount = articleInfo.buryCount;
                    v0_1 = 1;
                }

                if (articleInfo.videoWatchCount < 0 || article.videoWatchCount >= articleInfo.videoWatchCount) {
                    articleInfo.videoWatchCount = v6;
                } else {
                    article.videoWatchCount = articleInfo.videoWatchCount;
                    v0_1 = 1;
                }

                if (articleInfo.userDigg) {
                    if ((article.userDigg) || (article.userBury)) {
                        articleInfo.userDigg = false;
                    } else {
                        article.userDigg = true;
                        v0_1 = 1;
                    }

                    articleInfo.userBury = false;
                } else {
                    if (!articleInfo.userBury) {
                    } else if (!article.userDigg && !article.userBury) {
                        article.userBury = true;
                        v0_1 = 1;
                    } else {
                        articleInfo.userBury = false;
                    }
                }

                if ((android.support.design.a.isTextEmpty(articleInfo.shareUrl)) || (articleInfo.shareUrl.equals(article.shareUrl))) {
                    articleInfo.shareUrl = v7;
                } else {
                    article.shareUrl = articleInfo.shareUrl;
                    v0_1 = 1;
                }

                if ((android.support.design.a.isTextEmpty(articleInfo.displayUrl)) || (articleInfo.displayUrl.equals(article.displayUrl))) {
                    articleInfo.displayUrl = v7;
                } else {
                    article.displayUrl = articleInfo.displayUrl;
                    v0_1 = 1;
                }

                if ((android.support.design.a.isTextEmpty(articleInfo.displayTitle)) || (articleInfo.displayTitle.equals(article.displayTitle))) {
                    articleInfo.displayTitle = v7;
                } else {
                    article.displayTitle = articleInfo.displayTitle;
                    v0_1 = 1;
                }

                if (articleInfo.delete) {
                    article.delete = true;
                    article.commentCount = 0;
                }

                if ((articleInfo.banComment) && !article.mBanComment) {
                    article.mBanComment = true;
                    v0_1 = 1;
                }

                if (v0_1 != 0 && !articleInfo.delete) {
                    DBHelper.getInstance(this.o).updateArticleInfo(articleInfo);
                }

                if (this.c == article) {
                    this.b(article);
                }

                if (v3 != null && this.c == article) {
                    if (article.delete) {
                        if (!this.o()) {
                            ((NewDetailActivity) this.getActivity()).switchToArticleDeleted(article);
                        } else {
                        }

                        return;
                    } else {
                        if ((!android.support.design.a.isTextEmpty(articleInfo.context) || !android.support.design.a.isTextEmpty(articleInfo.script)) && (v3.o)) {
                            String v4 = g(v3.mScrollListenerWebView.getOriginalUrl());
                            boolean v0_2 = v4 == null || !v4.startsWith("file:///android_asset/article/") ? false : true;
                            if ((v0_2) || (v3.mScrollListenerWebView.canGoBack()) || !article.hasArticleUrl() || v4 == null || !MediaAppUtil.a(v4, article.articleUrl)) {
                                v1 = v0_2 ? 1 : 0;
                            }

                            if (!v0_2 && !(v1 > 0)) {
                            } else {
                                this.embedContextInfo(v3, articleInfo, v0_2);
                            }
                        }
                        com.ss.android.article.base.feature.detail2.picgroup.a.b v0_3 = v3.g;
                        v0_3.mArticleInfo = articleInfo;
                        if (articleInfo == null) {

                        } else {
                            if (articleInfo.D != null && (articleInfo.D.isValid())) {
                                SubscriptionRouter.c(new TitleBarAdEvent((byte) 0));
                            }

                            if (articleInfo.mWebInfo == null) {

                            } else {
                                LinearLayout.LayoutParams v1_2 = new LinearLayout.LayoutParams(v6, -2);
                                v1_2.bottomMargin = ((int) UIUtils.dp2px(v0_3.mActivity, 8f));
                                v0_3.c = new DetailAdTextLinkLayout(v0_3.mActivity);
                                v0_3.c.setLayoutParams(((ViewGroup.LayoutParams) v1_2));
                                v0_3.b.addView(v0_3.c);
                                v0_3.c.setTitleText(articleInfo.mWebInfo.title);
                                v0_3.c.setTitleOnClickListener(new com.ss.android.article.base.feature.detail2.picgroup.a.c(v0_3, articleInfo));
                            }
                        }
                    }
                }

                if ((this.w()) && (this.b(this.i))) {
                    this.i.j.k.setBindArticleInfo(articleInfo);
                    this.i.j.k.setArticleDetail(this.I);
                }

                if (this.i != null && this.i.j != null) {
                    this.i.j.D = articleInfo;
                }

                this.i.mNewDetailAdapter.mArticle = this.c;
                if (v3 != null && v3.mWapStatHelper != null && (this.i.mWapStatHelper.a)) {
                    this.appendRecomAdAndRelatedGallery(this.i);
                }

                if (v3 == null) {
                    return;
                }

                if (v3.g.c == null) {
                    return;
                }

                AppData.isNightMode();
                v3.g.c.adaptNightMode();
            }
        }
    }

    public final void onArticleDetailLoadedWithCache(Article article, ArticleDetail articleDetail) {
    }

    public final void onLoaded(Article article, AbsArticle absArticle, ArticleDetail articleDetail) {
    }

    public final void a(IVideoFullscreen videoFullscreen) {
    }

    public final void onLoaded(String arg15, long arg16, Response response) {
        boolean v2_1;
        String v3_1;
        if (!this.o() && !this.w() && !android.support.design.a.isTextEmpty(arg15) && response != null) {
            com.ss.android.article.base.feature.detail2.picgroup.a.a v5 = this.i;
            if (v5 != null) {
                Article v6 = this.c;
                if (v6 != null && v6.groupId == arg16) {
                    this.aF = response;
                    String v2 = null;
                    if (response.responseCode == 200 && response.requestUrl != null && !MediaAppUtil.a(response.requestUrl, arg15) && (MediaAppUtil.a(v6.articleUrl, arg15))) {
                        v2 = response.requestUrl;
                    }

                    if (this.aB == 2) {
                        String v4 = null;
                        if (v6.hasArticleUrl()) {
                            v4 = v6.articleUrl;
                            boolean v3 = v6.d();
                            if (v2 != null) {
                                boolean v12 = v3;
                                v3_1 = v2;
                                v2_1 = v12;
                            } else {
                                v2_1 = v3;
                                v3_1 = v4;
                            }
                        } else {
                            v2_1 = false;
                            v3_1 = v4;
                        }

                        if (!android.support.design.a.isTextEmpty(v3_1)) {
                            long v8 = this.a;
                            if (this.aq != null && v8 <= 0) {
                                this.aq.a(v3_1);
                            }

                            this.a(v5, v3_1, v2_1);
                        }

                        this.aB = 0;
                        if (!this.x()) {
                            return;
                        }

                        if (!this.c(this.i)) {
                            return;
                        }

                        if (!this.o()) {
                            ((NewDetailActivity) this.getActivity()).setCommentCount(v6.commentCount);
                            ((NewDetailActivity) this.getActivity()).setFavorIconSelected(v6.userRepin);
                        }

                        if (this.o()) {
                            return;
                        }

                        ((NewDetailActivity) this.getActivity()).setUserAvatar((String) null);
                        return;
                    }

                    this.aB = 0;
                }
            }
        }
    }

    public final void onArticleDetailLoadedFromInternet(String arg2, Article article, ArticleDetail articleDetail) {
        if (!this.o()) {
            this.a(articleDetail);
        }
    }

    protected final void a(String arg10, BaseArticle arg11) {
        long v6 = 0;
        if (arg11 != null && arg11.groupId > v6) {
            JSONObject v8 = new JSONObject();
            try {
                v8.put("item_id", arg11.itemId);
                v8.put("aggr_type", arg11.aggrType);
            } catch (JSONException v0) {
            }

            MobClickCombiner.onEvent(this.getContext(), "detail", arg10, arg11.groupId, v6, v8);
        }
    }

    public final void comment(String userName, String text, long commentId, int arg8) {
        if (this.isActive()) {
            com.ss.android.article.base.feature.detail2.picgroup.a.a v0 = this.i;
            Article v1 = this.c;
            if (v0 != null && v1 != null && !v1.mBanComment && this.j != null && this.l != null) {
                this.p = arg8;
                this.l.a(Comment.a(this.j, userName, text), commentId, true);
            }
        }
    }

    final void handleDownload(String arg11, String arg12, String arg13) {
        JSONObject v5;
        JSONObject v1;
        long v8 = 0;
        String v0 = null;
        if (this.i != null && this.i.mScrollListenerWebView != null) {
            v0 = this.i.mScrollListenerWebView.getUrl();
        }

        if (this.a <= v8 && !android.support.design.a.isTextEmpty(v0) && !this.d.j(v0)) {
            v1 = new JSONObject();
            JSONObject v2 = new JSONObject();
            try {
                v2.put("url", arg11);
                v2.put("referer_url", v0);
                v1.put("label", "browser");
                v1.put("ext_json", v2);
            } catch (JSONException v0_1) {
            }

            AppUtil.reportAppDownloadBanned(this.getContext(), v1);
            return;
        }

        try {
            v5 = new JSONObject();
            v1 = new JSONObject();
            try {
                v1.put("url", arg11);
                v1.put("ad_id", this.a);
                if (!android.support.design.a.isTextEmpty(v0)) {
                    v1.put("referer_url", v0);
                }

                if (this.c != null) {
                    v1.put("group_id", this.c.groupId);
                    v1.put("item_id", this.c.itemId);
                    v1.put("aggr_type", this.c.aggrType);
                    if (!android.support.design.a.isTextEmpty(v0) && !MediaAppUtil.a(v0, this.c.articleUrl)) {
                        v1.put("init_url", this.c.articleUrl);
                    }
                }

                if (this.a <= v8) {
                    v1.put("in_white_list", 1);
                }

                v5.put("label", "browser");
                v5.put("ext_json", v1);
            } catch (JSONException v0_1) {
            }
            AppUtil.a(this.o, this.d, arg11, arg12, arg13, v5, new long[1]);
        } catch (Exception v0_2) {
            Logger.w(TAG, "handleDownload exception " + arg11 + " : " + v0_2);
        }
    }

    public final void queryContextData(String key, HashMap arg4) {
        if ("cid".equals(key)) {
            arg4.put(key, Long.valueOf(this.a));
        } else if ("log_extra".equals(key)) {
            arg4.put(key, this.y);
        }
    }

    public final void shareToWeChat(String arg4, JSONObject arg5) {
        this.s.position = arg4;
        this.s.fillShareParams(arg5);
        this.s.share(2, this.c);
    }

    public final void zoomStatus(boolean arg1) {
        this.f = arg1;
    }

    public final boolean a(CommentWrapper arg2) {
        return this.aE.contains(arg2);
    }

    public final boolean a(Article article) {
        return false;
    }

    public final boolean a(Article article, int arg3) {
        return false;
    }

    final boolean b(com.ss.android.article.base.feature.detail2.picgroup.a.a arg8) {
        PictureDetailLayout v0_2;
        boolean v0;
        if (arg8 == null) {
            v0 = false;
        } else {
            if (arg8.j == null) {
                arg8.j = new com.ss.android.article.base.feature.detail2.picgroup.a.d(this, this.N, this.e, arg8.mSwipeBackLayout, this.aG);
            }

            if (arg8.j.k == null) {
                com.ss.android.article.base.feature.detail2.picgroup.a.d v1 = arg8.j;
                com.ss.android.article.base.feature.detail2.picgroup.a.d v2 = arg8.j;
                ViewGroup v0_1 = this.e;
                String v3 = this.T();
                if (v2.k == null) {
                    v2.k = (PictureDetailLayout) ((ViewStub) v0_1.findViewById(com.ss.android.article.browser.R.id.picture_detail_layout_viewstub)).inflate();
                }

                if (v2.k == null) {
                    v0_2 = null;
                } else {
                    v2.k.setCallback(this);
                    v2.k.setGoDetailLabel(v3);
                    v0_2 = v2.k;
                }

                v1.k = v0_2;
            }
            if (arg8.j.k != null) {
                return true;
            }

            v0 = false;
        }

        return v0;
    }

    private void b(boolean arg7) {
        Article v1 = this.c;
        if (this.s != null && v1 != null) {
            if (arg7) {
                ArticleInfo v0 = null;
                if (this.i != null && this.i.g != null) {
                    v0 = this.i.g.mArticleInfo;
                }

                switch (this.getCommentMode()) {
                    case 1:
                    case 2: {
                        this.s.mCategoryName = this.L;
                        this.s.c(v1, v0, this.a);
                        return;
                    }
                }

                if (!v1.m() && !v1.n()) {
                    this.s.b(v1, v0, this.a);
                    return;
                }

                this.s.a(v1, v0, this.a);
                return;

            } else {
                this.s.mCategoryName = this.L;
                this.s.a(v1, this.a, true);
            }
        }
    }

    final void b(Article arg4) {
        if (arg4 != null) {
            Article v2 = this.c;
            if (v2 != null) {
                switch (this.getCommentMode()) {
                    case 0: {
                        if (!this.o()) {
                            ((NewDetailActivity) this.getActivity()).setFavorIconSelected(((AbsArticle) v2).userRepin);
                        }

                        break;
                    }
                }

                boolean v1 = ((AbsArticle) v2).mBanComment ? false : true;
                if (this.o()) {
                    return;
                }

                ((NewDetailActivity) this.getActivity()).setCommentCount(((AbsArticle) v2).commentCount);
                ((NewDetailActivity) this.getActivity()).setWriteCommentEnabled(v1);
            }
        }
    }

    public final void onHideCustomView() {
    }

    final void b(int arg3) {
        this.e("");
        ImpressionListAdapter v0 = this.aL;
        if (v0 != null) {
            int v1 = this.O();
            if (v1 > 0) {
                v0.onMovedToScrapHeap(arg3 / v1);
            }
        }
    }

    public final void onPageFinished(WebView webView, String url) {
        String v2;
        boolean v1;
        int v0;
        if (!this.o()) {
            if (Logger.debug()) {
                Logger.v(TAG, "onPageFinished " + url);
            }

            if (url == null) {
                return;
            }

            if (url.equals("about:blank")) {
                return;
            }

            com.ss.android.article.base.feature.detail2.picgroup.a.a v10 = this.i;
            if (v10 == null) {
                return;
            }

            Article v11 = this.c;
            if (v11 == null) {
                return;
            }

            if (url.startsWith("file:///android_asset/article/")) {
                v10.o = true;
                v0 = 1;
                v1 = true;
            } else {
                if (TTUtils.isValidUrl(url)) {
                    v10.o = true;
                    if (v11.hasArticleUrl()) {
                        v2 = webView.getOriginalUrl();
                        if (!AppUtil.a(v11.articleUrl, url) && !AppUtil.a(v11.articleUrl, v2)) {
                            if (this.aF == null) {
                                v0 = 0;
                                v1 = false;
                            } else if (AppUtil.a(this.aF.requestUrl, url)) {
                                long v6 = System.currentTimeMillis();
                                v11.webTcLoadTime = v6;
                                v11.webTypeLoadTime = v6;
                                this.O.saveWebLoadTime(v11.groupId, v11.itemId, v6, true);
                                this.O.saveWebLoadTime(v11.groupId, v11.itemId, v6, false);
                                v1 = false;
                                v0 = 1;
                            } else {
                                v0 = 0;
                                v1 = false;
                            }
                        } else {
                            long v6 = System.currentTimeMillis();
                            v11.webTcLoadTime = v6;
                            v11.webTypeLoadTime = v6;
                            this.O.saveWebLoadTime(v11.groupId, v11.itemId, v6, true);
                            this.O.saveWebLoadTime(v11.groupId, v11.itemId, v6, false);
                            v1 = false;
                            v0 = 1;
                        }
                    } else {
                        v0 = 0;
                        v1 = false;
                    }
                } else {
                    v0 = 0;
                    v1 = false;
                }
            }
            if (this.a > 0 && webView != null && this.d != null) {
                v2 = SSWebSettings.buildAdJs(this.d.jsActlogUrl, this.a);
                if (!android.support.design.a.isTextEmpty(v2)) {
                    LoadUrlUtils.loadUrl(webView, v2);
                }
            }

            this.d.ae();
            this.c.hasArticleUrl();
            v10.mWapStatHelper.onPageFinished(webView, url);
            if ((v1) || v0 != 0) {
                Object v0_1 = this.aw.get(Long.valueOf(v11.groupId));
                long v2_1 = System.currentTimeMillis();
                if (v0_1 != null && v2_1 - ((ArticleInfo) v0_1).d < 600000) {
                    this.embedContextInfo(v10, ((ArticleInfo) v0_1), v1);
                } else {
                    this.c(v11);
                }
            }

            if (!android.support.design.a.isTextEmpty(this.e(url)) && this.aL != null && (this.aL.b().isEmpty())) {
                this.k.postDelayed(new com.ss.android.article.base.feature.detail2.picgroup.q(this), 1000);
            }

            this.appendRecomAdAndRelatedGallery(this.i);
        }
    }

    public final void b(Comment arg8) {
        if ((this.isViewValid()) && arg8 != null) {
            this.av = arg8;
            if (this.i != null && this.c != null) {
                Comment v0 = this.av;
                if (v0 != null && this.c.groupId == v0.groupId) {
                    MobClickCombiner.onEvent(this.getContext(), "comment", "click_comment");
                    MobClickCombiner.onEvent(this.getContext(), "comment", "repost_menu");
                    if (this.l != null) {
                        this.l.b();
                        this.l.a(v0.a(this.j), v0.commentId, false);
                        this.p = 0;
                    } else {
                    }

                    return;
                }

                this.av = null;
            }
        }
    }

    public final void addComment(CommentWrapper arg2) {
        this.aE.add(arg2);
    }

    public final void slideDownload(String arg3) {
        if (e(this.i)) {
            com.ss.android.article.base.feature.detail2.picgroup.a.d v0 = this.i.j;
            if (v0.a != null && (v0.a.isViewValid()) && !android.support.design.a.isTextEmpty(arg3)) {
                new SaveImageBottomDialog(v0.a.getActivity(), arg3).show();
            }
        }
    }

    public final void shareToQQ(String arg4, JSONObject arg5) {
        this.s.position = arg4;
        this.s.fillShareParams(arg5);
        this.s.share(3, this.c);
    }

    final boolean c(com.ss.android.article.base.feature.detail2.picgroup.a.a arg7) {
        boolean v0;
        if (arg7 == null) {
            v0 = false;
        } else {
            if (arg7.j == null) {
                arg7.j = new com.ss.android.article.base.feature.detail2.picgroup.a.d(this, this.N, this.e, arg7.mSwipeBackLayout, this.aG);
            }

            v0 = true;
        }

        return v0;
    }

    private void c(Article arg5) {
        if (arg5 != null) {
            Object v0 = this.aw.get(Long.valueOf(arg5.groupId));
            long v2 = System.currentTimeMillis();
            int v0_1 = v0 == null || v2 - ((ArticleInfo) v0).d > 600000 ? 1 : 0;
            if (v0_1 == 0) {
                return;
            }

            if (!NetworkUtils.isNetworkAvailable(this.o)) {
                return;
            }

            DetailLoader v1 = this.mDetailLoader;
            String v2_1 = arg5.getItemKey();
            String v0_2 = this.ae ? "apn" : this.W;
            v1.loadArticleInfo(v2_1, arg5, v0_2);
        }
    }

    public final void c(String arg3) {
        MobClickCombiner.onEvent(this.getContext(), "detail", arg3);
    }

    public final TTAndroidObject getTTAndroidObject() {
        return this.mNewArticleDetailTTAndroidObject;
    }

    public final void onSharePlatformClick(int arg3) {
        if (arg3 >= 0) {
            this.s.position = "detail_bottom_bar_out";
            this.s.share(arg3, this.c);
        }
    }

    public final void deleteComment(Comment arg5) {
        if (arg5 != null && (UpdateItemMgr.getInstance(this.getContext()).checkLoginAndNet(arg5.userId))) {
            UpdateItemMgr.showDeleteConfirmDialog(this.getContext(), new com.ss.android.article.base.feature.detail2.picgroup.e(this, arg5));
        }
    }

    public final void shareToMoment(String arg4, JSONObject arg5) {
        this.s.position = arg4;
        this.s.fillShareParams(arg5);
        this.s.share(1, this.c);
    }

    public final boolean shouldOverrideUrlLoading(WebView webView, String url) {
        boolean v2_8;
        com.ss.android.article.base.feature.detail2.picgroup.a.a v2_7;
        int v2_3;
        int v8;
        String v4_2;
        String v3_1;
        String scheme = null;
        Uri v3 = null;
        Uri v2;
        if (!android.support.design.a.isTextEmpty(url) && !this.o()) {
            if (Logger.debug()) {
                Logger.v(TAG, "check url: " + System.currentTimeMillis() + " " + url);
            }

            try {
                v2 = Uri.parse(url);
                v3 = v2;
                scheme = v2.getScheme();
            } catch (Exception v4) {
                Uri v16 = v3;
                v3_1 = scheme;
                v2 = v16;
            }

            if (v3 != null && (((String) scheme)) != null) {
                if (((String) scheme).equals("bytedance")) {
                    try {
                        v2 = Uri.parse(url);
                    } catch (Exception v3_2) {
                    }

                    if (v2 != null) {
                        v3_1 = v2.getHost();
                        Article v9 = this.c;
                        long v4_1 = this.a;
                        if ("domReady".equals(v3_1)) {
                            this.onDomReady(webView);
                        } else if ("origin_image".equals(v3_1)) {
                            this.c("enlarger_image");
                        } else if ("show_image".equals(v3_1)) {
                            this.c("show_one_image");
                        } else if ("video".equals(v3_1)) {
                            v3_1 = v2.getQueryParameter("play_url");
                            v4_2 = v2.getQueryParameter("json");
                            String v5 = webView.getUrl();
                            long v14 = v9 != null ? v9.groupId : this.b;
                            long v12 = v9 != null ? v9.itemId : this.A;
                            v8 = v9 != null ? v9.aggrType : this.B;
                            Bundle v7 = null;
                            if (v14 > 0) {
                                v7 = new Bundle();
                                v7.putLong("group_id", v14);
                                v7.putLong("item_id", v12);
                                v7.putInt("aggr_type", v8);
                            }

                            MediaHelper.startMediaPlayerActivity(this.getActivity(), v3_1, v4_2, v5, AppUtil.getUserAgent(this.getContext(), webView), v7);
                            JSONObject v10 = new JSONObject();
                            try {
                                v10.put("item_id", v12);
                                v10.put("aggr_type", v8);
                            } catch (JSONException v2_2) {
                            }

                            MobClickCombiner.onEvent(this.getContext(), "video", "play", v14, 0, v10);
                        } else {
                            if ("contentchanged".equals(v3_1)) {
                                v2_3 = webView.getHeight();
                                int v3_3 = webView.getContentHeight();
                                if (!Logger.debug()) {

                                } else {
                                    Logger.d(TAG, "content changed " + url + " " + v2_3 + " " + v3_3);
                                }
                                return true;
                            }

                            if ("toggle_image".equals(v3_1)) {
                                v2_3 = this.d.clickShowLargeImageBtn;
                                if (v2_3 == 1) {
                                    this.d.setClickShowLargeImageBtn(v2_3 + 1);
                                    AlertDialog.Builder v3_4 = com.ss.android.j.b.createDialogBuilder(this.getActivity());
                                    v3_4.setTitle(com.ss.android.article.browser.R.string.ss_hint);
                                    v3_4.setMessage(com.ss.android.article.browser.R.string.detail_show_large_image_dlg);
                                    v3_4.setPositiveButton(this.getString(com.ss.android.article.browser.R.string.ss_confirm), new com.ss.android.article.base.feature.detail2.picgroup.p(this));
                                    v3_4.setNegativeButton(this.getActivity().getString(com.ss.android.article.browser.R.string.ss_cancel), null);
                                    v3_4.show();
                                } else if (v2_3 <= 0) {
                                    this.d.setClickShowLargeImageBtn(v2_3 + 1);
                                }

                                this.c("show_image");
                                return true;
                            }

                            if ("finish_content".equals(v3_1)) {
                                this.c("finish_content");
                                if (v9 == null) {
                                    return true;
                                }

                                this.a("finish_content", ((BaseArticle) v9), v4_1);
                                return true;
                            }

                            if ("finish_comment".equals(v3_1)) {
                                if (v9 == null) {
                                    return true;
                                }

                                this.a("finish_comment", ((BaseArticle) v9), v4_1);
                                return true;
                            }

                            if ("read_content".equals(v3_1)) {
                                if (v9 == null) {
                                    return true;
                                }

                                this.a("read_content", ((BaseArticle) v9), v4_1);
                                return true;
                            }

                            if ("user_profile".equals(v3_1)) {
                                try {
                                    if (Long.parseLong(v2.getQueryParameter("user_id")) <= 0) {
                                        return true;
                                    }

                                    scheme = v2.getQueryParameter("action");
                                    if ("digg".equals(scheme)) {
                                        this.c("click_digg_users");
                                    } else if ("bury".equals(scheme)) {
                                        this.c("click_bury_users");
                                    } else if ("repin".equals(scheme)) {
                                        this.c("click_favorite_users");
                                    }

                                    this.getActivity();
                                    AppData.aK();
                                } catch (Exception v2_4) {
                                    Logger.w(TAG, "url user_profile exception: " + url + " " + v2_4);
                                }

                                return true;
                            }

                            if ("click_source".equals(v3_1)) {
                                this.c("click_source");
                                return true;
                            }

                            if ("keywords".equals(v3_1)) {
                                try {
                                    v3_1 = v2.getQueryParameter("keyword");
                                    scheme = v2.getQueryParameter("index");
                                    if (android.support.design.a.isTextEmpty(v3_1)) {
                                        return true;
                                    }

                                    this.c("click_keyword_" + scheme);
                                    FragmentActivity v2_5 = this.getActivity();
                                    Intent v7_1 = new Intent();
                                    v7_1.setClassName(((Context) v2_5), "com.ss.android.article.base.feature.search.SearchActivity");
                                    v7_1.putExtra("keyword", v3_1);
                                    v7_1.putExtra("from", "content");
                                    Article v8_1 = this.c;
                                    v4_1 = 0;
                                    long v2_6 = 0;
                                    int v6 = 0;
                                    if (v8_1 != null) {
                                        v4_1 = ((AbsArticle) v8_1).groupId;
                                        v2_6 = ((AbsArticle) v8_1).itemId;
                                        v6 = ((AbsArticle) v8_1).aggrType;
                                    }

                                    v7_1.putExtra("group_id", v4_1);
                                    v7_1.putExtra("item_id", v2_6);
                                    v7_1.putExtra("aggr_type", v6);
                                    this.startActivity(v7_1);
                                } catch (Exception v2_4) {
                                    Logger.w(TAG, "url search excepton: " + url + " " + v2_4);
                                }

                                return true;
                            }

                            if ("media_account".equals(v3_1)) {
                                try {
                                    Long mediaId = Long.valueOf(Long.parseLong(v2.getQueryParameter("media_id")));
                                    this.c("click_pgc_profile");
                                    v4_2 = v2.getQueryParameter("loc");
                                    v2_3 = 0;
                                    if (!android.support.design.a.isTextEmpty(v4_2)) {
                                        v2_3 = Integer.parseInt(v4_2);
                                    }

                                    String enterFrom = v2_3 > 0 ? "article_bottom_author" : "article_top_author";
                                    PgcActivity.startActivity(this.o, mediaId.longValue(), enterFrom);
                                } catch (Exception v2_4) {
                                    Logger.w(TAG, "url pgc's media_account excepton: " + url + " " + v2_4);
                                }

                                return true;
                            }

                            if ("open_origin_url".equals(v3_1)) {
                                try {
                                    scheme = v2.getQueryParameter("url");
                                    if (!TTUtils.isValidUrl(scheme)) {
                                        return true;
                                    }

                                    this.e(webView, scheme);
                                } catch (Exception v2_4) {
                                    Logger.w(TAG, "open_origin_url exception: " + url + " " + v2_4);
                                }

                                return true;
                            }

                            if ("article_impression".equals(v3_1)) {
                                try {
                                    v4_1 = android.support.design.a.x(v2.getQueryParameter("groupid"));
                                    long v6_1 = android.support.design.a.x(v2.getQueryParameter("item_id"));
                                    v8 = android.support.design.a.d(v2.getQueryParameter("aggr_type"), 0);
                                    if (v9 == null) {
                                        return true;
                                    }

                                    if (v9.groupId <= 0) {
                                        return true;
                                    }

                                    if (v4_1 <= 0) {
                                        return true;
                                    }

                                    AppData.a(v9.groupId, v4_1, v6_1, v8);
                                } catch (Exception v2_4) {
                                }

                                return true;
                            }

                            if ("transcode_error".equals(v3_1)) {
                                v2_7 = this.i;
                                if (v2_7 == null) {
                                    return true;
                                }

                                if (v9 == null) {
                                    return true;
                                }

                                if (v9.delete) {
                                    return true;
                                }

                                if (!v9.c()) {
                                    return true;
                                }

                                this.a(com.ss.android.article.browser.R.drawable.close_popup_textpage, com.ss.android.article.browser.R.string.detail_transform_failed);
                                v2_7.mScrollListenerWebView.setTag(com.ss.android.article.browser.R.id.webview_transform_key, null);
                                v2_7.mScrollListenerWebView.setTag(com.ss.android.article.browser.R.id.webview_client_transform_key, null);
                                v2_7.mScrollListenerWebView.setTag(com.ss.android.article.browser.R.id.webview_support_js, null);
                                return true;
                            }

                            if (this.mNewArticleDetailTTAndroidObject == null) {
                                return true;
                            }

                            if (!NewArticleDetailTTAndroidObject.canHandleUri(v2)) {
                                return true;
                            }

                            try {
                                this.mNewArticleDetailTTAndroidObject.handleUri(v2);
                            } catch (Exception v2_4) {
                                Logger.w(TAG, "TTAndroidObj handleUri exception: " + v2_4);
                            }
                        }
                        return true;
                    } else {
                        return true;
                    }
                } else {
                    if (TTUtils.isValidUrl(url)) {
                        webView.setTag(com.ss.android.article.browser.R.id.webview_client_transform_key, null);
                        webView.setTag(com.ss.android.article.browser.R.id.webview_transform_key, null);
                        webView.setTag(com.ss.android.article.browser.R.id.webview_support_js, null);
                        this.f(url);
                        v2_7 = this.i;
                        if (v2_7 != null) {
                            v2_7.mWapStatHelper.b(webView, url);
                        }

                        return false;
                    }

                    if (!((String) scheme).equals("about") && !"about:blank".equals(url)) {
                        try {
                            if ((((String) scheme).equals("sslocal")) || (((String) scheme).equals("localsdk"))) {
                                url = AdsAppBaseActivity.b(url);
                            }

                            if (this.d.i(url)) {
                                return true;
                            }

                            if ((this.z) && !com.ss.android.article.base.feature.app.a.c.b(((String) scheme))) {
                                return true;
                            }

                            AppUtil.b(this.getContext(), url);
                        } catch (Exception v2_4) {
                        }

                        return true;
                    }

                    webView.setTag(com.ss.android.article.browser.R.id.webview_transform_key, null);
                    return false;
                }
            }

            v2_8 = true;
        } else {
            v2_8 = true;
        }

        return v2_8;
    }

    public final void d(String arg3) {
        MobClickCombiner.onEvent(this.getContext(), "slide_detail", arg3);
    }

    private void d(Article arg9) {
        if (arg9 != null) {
            arg9.clickTimestamp = System.currentTimeMillis();
            DBHelper v0 = DBHelper.getInstance(this.o);
            if (v0 != null) {
                v0.syncReadTs(((AbsArticle) arg9));
                if (ArticleHelper.b >= 0 && arg9 != null && this.d != null) {
                    FeedTab v0_1 = this.d.t();
                    if (v0_1 != null) {
                        ArrayList v1 = new ArrayList();
                        v0_1.getCurrentList(-1, v1);
                        if (((List) v1).size() > ArticleHelper.b) {
                            Object v0_2 = ((List) v1).get(ArticleHelper.b);
                            if (v0_2 != null && ((CellRef) v0_2).ac != null && ((CellRef) v0_2).ac.size() != 0) {
                                int v2 = 0;
                                while (v2 < ((CellRef) v0_2).ac.size()) {
                                    Object v1_1 = ((CellRef) v0_2).ac.get(v2);
                                    if (((CellRef) v1_1).article.groupId == arg9.groupId) {
                                        ((CellRef) v1_1).article.clickTimestamp = System.currentTimeMillis();
                                        ArticleHelper.a(this.getContext(), ((CellRef) v0_2), v2);
                                    } else {
                                        ++v2;
                                        continue;
                                    }

                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    private View d(int arg2) {
        return this.e.findViewById(arg2);
    }

    private void appendRecomAdAndRelatedGallery(com.ss.android.article.base.feature.detail2.picgroup.a.a arg7) {
        Logger.d(TAG, "appendRecomAdAndRelatedGallery, mHasAppendRecomAdAndRelatedGallery = " + this.mHasAppendRecomAdAndRelatedGallery);
        if (!this.mHasAppendRecomAdAndRelatedGallery
                && (this.x())
                && arg7 != null
                && arg7.mScrollListenerWebView != null
                && arg7.g != null
                && arg7.g.mArticleInfo != null
                && (arg7.g.mArticleInfo.imageRecom != null || arg7.g.mArticleInfo.relatedSlides != null)) {
            if ((e(arg7)) && arg7.g.mArticleInfo.relatedSlides != null) {
                arg7.j.a(android.support.design.a.a(this.c.groupId, this.c.itemId, null), arg7.g.mArticleInfo.relatedGalleryList);
            }

            JSONObject v1 = new JSONObject();
            try {
                if (arg7.g.mArticleInfo.imageRecom != null && arg7.g.mArticleInfo.F != null && arg7.g.mArticleInfo.F.adType == 2) {
                    v1.put("image_recom", arg7.g.mArticleInfo.imageRecom);
                }

                if (arg7.g.mArticleInfo.relatedSlides == null) {
                } else {
                    v1.put("related_slides", arg7.g.mArticleInfo.relatedSlides);
                }
            } catch (JSONException v0) {
                v0.printStackTrace();
            }
            StringBuilder v0_1 = new StringBuilder();
            this.mHasAppendRecomAdAndRelatedGallery = true;
            v0_1.append("javascript:TTGallery.appendSlides(");
            v0_1.append(v1.toString());
            v0_1.append(")");
            arg7.mScrollListenerWebView.loadUrl(v0_1.toString());
        }
    }

    public final void toggleGalleryBars() {
        if ((e(this.i)) && !this.i.j.s && !this.o()) {
            ((NewDetailActivity) this.getActivity()).startTitleBarAnimation(this.i.j.u);
            com.ss.android.article.base.feature.detail2.picgroup.a.d v1 = this.i.j;
            boolean v0 = !this.i.j.u ? true : false;
            v1.u = v0;
            String v0_1 = this.i.j.u ? "show_content" : "hide_content";
            this.c(v0_1);
        }
    }

    public final void doUpdateVisitedHistory(WebView webView, String url) {
        if (!this.o() && webView != null) {
            com.ss.android.article.base.feature.detail2.picgroup.a.a v0 = this.i;
            if (v0 != null && this.c != null && this.a > 0) {
                v0.mWapStatHelper.c(webView, url);
            }
        }
    }

    private static boolean e(com.ss.android.article.base.feature.detail2.picgroup.a.a arg1) {
        boolean v0 = arg1 == null || arg1.j == null ? false : true;
        return v0;
    }

    private void e(Article arg3) {
        if (arg3 != null && (arg3.hasArticleUrl()) && this.mDetailLoader != null) {
            this.mDetailLoader.mHttpRequestHeaders = arg3.wapHeaders;
            String v0 = this.at;
            if (!arg3.e()) {
                v0 = this.as;
            }

            if (android.support.design.a.isTextEmpty(v0)) {
                return;
            }

            this.mDetailLoader.mUserAgent = v0;
        }
    }

    private void e(WebView arg7, String arg8) {
        String v1_1;
        String v0_2;
        int v1;
        int v0 = 0;
        try {
            if (Logger.debug()) {
                Logger.d(TAG, arg7.getUrl() + " " + arg8);
            }

            int[] v2 = this.d.w;
            if (v2 != null && v2.length > 0) {
                int v3 = v2.length;
                v1 = 0;
                while (true) {
                    label_20:
                    if (v1 < v3) {
                        com.ss.android.newmedia.b.a v4 = android.support.design.a.d(v2[v1]);
                        if (v4 != null && (v4.a(this.o, arg8))) {
                            this.c(v4.a());
                            v0 = 1;
                        } else {
                            ++v1;
                            continue;
                        }
                    }
                    break;
                }
            }
            if (v0 != 0) {
                return;
            }

            this.c("open_src_url");
            v0_2 = arg7.getUrl();
            if (!TTUtils.isValidUrl(v0_2)) {
                v1_1 = null;
            } else {
                v1_1 = v0_2;
            }
            android.support.design.a.b(this.getActivity(), arg8, v1_1);
        } catch (Exception v0_1) {
            v0_1.printStackTrace();
        }
    }

    final String e(String arg13) {
        ImpressionListAdapter v1_1;
        String v0_2;
        String v4 = null;
        String v1 = android.support.design.a.isTextEmpty(arg13) ? this.Y() : g(arg13);
        if (!android.support.design.a.isTextEmpty(v1)) {
            Article v6 = this.c;
            long v2 = 0;
            if (v6 != null) {
                v2 = v6.groupId;
            }

            String v5 = String.valueOf(v2) + "_" + v1;
            Object v0 = this.aJ.get(v5);
            if (v0 == null) {
                a$b v7 = new a$b();
                v7.a = this.aJ.size();
                if (v6 != null) {
                    com.ss.android.article.base.utils.JSONObjectWrapper v0_1 = new com.ss.android.article.base.utils.JSONObjectWrapper();
                    v0_1.put("item_id", v6.itemId);
                    v0_1.put("aggr_type", v6.aggrType);
                    v0_2 = v0_1.jsonObject.toString();
                } else {
                    v0_2 = v4;
                }

                ImpressionListAdapter v6_1 = new ImpressionListAdapter(String.valueOf(v2) + "_" + v7.a + "_" + v1, v0_2);
                v7.b = v6_1;
                this.registerLifeCycleMonitor(((LifeCycleMonitor) v6_1));
                this.aJ.put(v5, v7);
                v1_1 = v6_1;
            } else {
                v1_1 = ((a$b) v0).b;
            }

            if (v1_1 == null) {
                return v4;
            }

            int v0_3 = this.O();
            int v2_1 = this.P();
            int v3 = v2_1 / v0_3;
            v0_3 = v2_1 % v0_3 != 0 ? 1 : 0;
            v1_1.a(v0_3 + v3);
            this.aL = v1_1;
            v4 = v5;
        }

        return v4;
    }

    private void f(String arg7) {
        Object v0;
        String v1 = g(arg7);
        if (v1 != null) {
            String v2 = this.e(v1);
            if (!android.support.design.a.isTextEmpty(v2) && !this.aJ.isEmpty()) {
                Iterator v3 = this.aJ.entrySet().iterator();
                while (v3.hasNext()) {
                    v0 = v3.next();
                    if (!v2.equals(((Map.Entry) v0).getKey())) {
                        continue;
                    }

                    v0 = ((Map.Entry) v0).getValue();
                    if (v0 == null) {
                        continue;
                    }

                    if (((a$b) v0).a < 0) {
                        continue;
                    }

                    ImpressionListAdapter v0_1 = ((a$b) v0).b;
                    if (v0_1 == null) {
                        continue;
                    }

                    v0_1.onPause();
                }
            }

            if (this.aL != null) {
                this.aL.onResume();
            }

            v0 = this.aK.get(v1);
            if (v0 != null) {
                ((a$a) v0).mMaxScrollHeight = 0;
                return;
            }

            a$a v0_2 = new a$a((byte) 0);
            v0_2.mUrl = v1;
            v0_2.c = this.aK.size();
            this.aK.put(v1, v0_2);
        }
    }

    public final AbsArticle getArticle() {
        return this.c;
    }

    private static String g(String arg4) {
        if (android.support.design.a.isTextEmpty(arg4)) {
            arg4 = null;
        } else {
            int v0 = arg4.indexOf(35);
            if (v0 > 0) {
                int v1 = arg4.indexOf("tt_font=", v0);
                if (v1 == v0 + 1) {
                    arg4 = arg4.substring(0, v0);
                } else if (v1 > v0) {
                    v1 = arg4.indexOf("&tt_font=", v0);
                    if (v1 > v0) {
                        arg4 = arg4.substring(0, v1);
                    }
                }
            }

            if (!arg4.startsWith("file:///android_asset/article/")) {
                return arg4;
            }

            v0 = arg4.indexOf("&token=");
            if (v0 <= 0) {
                return arg4;
            }

            arg4 = arg4.substring(0, v0);
        }

        return arg4;
    }

    public final long getArticleId() {
        return this.a;
    }

    public final int getCommentMode() {
        Article v0 = this.c;
        int v0_1 = v0 == null ? 0 : v0.getCommentMode();
        return v0_1;
    }

    public final void onBack() {
        if (this.i != null && !this.i.j.t) {
            if ((e(this.i)) && (this.i.j.s)) {
                this.M();
                return;
            }

            if ((this.x()) && this.mNewArticleDetailTTAndroidObject != null) {
                this.mNewArticleDetailTTAndroidObject.b("close", null);
            }

            if (this.o()) {
                return;
            }

            ((NewDetailActivity) this.getActivity()).finishPage();
        }
    }

    public void handleMsg(Message message) {
        Article v1_1;
        String v2_1;
        boolean v1 = false;
        if (!this.isViewValid()) {
            return;
        }

        if (this.l != null && (this.l.handleMsg(message))) {
            return;
        }

        AppData.isNightMode();
        switch (message.what) {
            case 17: {
                if (this.i == null) {
                    return;
                }

                if (this.i.mWapStatHelper.a) {
                    return;
                }

                if (this.c == null) {
                    return;
                }

                if (this.c.ignoreWebTransform) {
                    return;
                }

                this.ak = true;
                this.c.articleType = 0;
                com.ss.android.article.base.feature.detail2.picgroup.a.a v2 = this.i;
                if (v2 != null) {
                    Article v0_1 = this.c;
                    if (!this.w && v0_1 == null) {
                    } else {
                        v2.mLoadingFlashView.setVisibility(View.VISIBLE);
                        v2.mLoadingFlashView.start();
                        if (v0_1 != null) {
                            v2_1 = v0_1.getItemKey();
                            v1_1 = v0_1;
                        } else {
                            String v7 = Article.a(this.b, this.A);
                            v1_1 = new Article(this.b, this.A, this.B);
                            v2_1 = v7;
                        }

                        this.mDetailLoader.loadArticleDetail(v2_1, v0_1, ((AbsArticle) v1_1));
                    }
                }

                JSONObject jsonObject = new JSONObject();
                try {
                    jsonObject.put("item_id", this.c.itemId);
                    jsonObject.put("aggr_type", this.c.aggrType);
                } catch (Exception exception) {
                }
                MobClickCombiner.onEvent(this.o, "detail", "transcode_start", this.c.groupId, 0, jsonObject);
                return;
            }
            case 1003: {
                v1 = true;
                if (!(message.obj instanceof CommentFetcher)) {
                    return;
                }

                this.onCommentLoaded((CommentFetcher) message.obj, v1);
                return;
            }
            case 1004: {
                if (!(message.obj instanceof CommentFetcher)) {
                    return;
                }
                this.onCommentLoaded((CommentFetcher) message.obj, v1);
                return;
            }
            case 10001: {
                this.a(com.ss.android.article.browser.R.drawable.doneicon_popup_textpage, com.ss.android.article.browser.R.string.toast_report_ok);
                return;
            }
            case 10002: {
                this.a(com.ss.android.article.browser.R.drawable.close_popup_textpage, com.ss.android.article.browser.R.string.toast_report_fail);
                return;
            }
            case 10011: {
                if (this.isActive()) {
                    return;
                }

                if (this.i == null) {
                    return;
                }

                try {
                    this.i.mScrollListenerWebView.getSettings().setBlockNetworkLoads(true);
                } catch (Exception v0) {
                }

                return;
            }
        }
        return;
    }

    public final int i() {
        int v0_1;
        int v2 = 0;
        float v5 = 100f;
        Object v1 = null;
        Iterator v3 = this.aK.values().iterator();
        while (v3.hasNext()) {
            Object v0 = v3.next();
            if (((a$a) v0).c != 0) {
                v0 = v1;
            }

            v1 = v0;
        }

        if (!this.w() || !e(this.i) || this.i.j.k == null || this.i.j.k.k <= 0) {
            if ((this.x()) && (e(this.i)) && this.i.j.y > 0) {
                v0_1 = ((int) ((((float) (this.i.j.x + 1))) / (((float) this.i.j.y)) * v5));
                return v0_1;
            }

            if (v1 != null && ((a$a) v1).mUrl != null && this.c != null) {
                if (!((a$a) v1).mUrl.startsWith("file:///android_asset/article/") && !MediaAppUtil.a(((a$a) v1).mUrl, this.c.articleUrl)) {
                    return 0;
                }

                v0_1 = this.O();
                int v1_1 = this.P();
                if (v1_1 == 0) {
                    return v2;
                }

                a$a v3_1 = this.I();
                if (v3_1 == null) {
                    return v2;
                }

                v0_1 = Math.round(Math.max(0f, (((float) (v0_1 + v3_1.mMaxScrollHeight))) / (((float) v1_1))) * v5);
            } else {
                label_86:
                v0_1 = 0;
            }

            label_33:
            v2 = v0_1;
        } else {
            v0_1 = ((int) (this.i.j.k.getReadPct() * v5));
            v2 = v0_1;
        }

        return v2;
    }

    public final long j() {
        long v0 = this.t < 0 ? -1 : System.currentTimeMillis() - this.t;
        return v0;
    }

    public final int k() {
        return 0;
    }

    public final void onRelatedShow() {
        if (e(this.i)) {
            this.i.j.z = true;
        }
    }

    public final void onAdImageClick() {
        if (this.i != null && this.i.g != null && this.i.g.mArticleInfo != null && this.i.g.mArticleInfo.F != null) {
            AdsAppItem.a(this.getContext(), this.i.g.mArticleInfo.F.openUrl, this.i.g.mArticleInfo.F.webUrl, this.i.g.mArticleInfo.F.webTitle, this.i.g.mArticleInfo.F.orientation, new AdsAppItem.b(this.getContext(), "embeded_ad", "click", this.i.g.mArticleInfo.F.id, this.i.g.mArticleInfo.F.logExtra));
        }
    }

    public final void adImageLoadFinish() {
        String v3 = "load_finish";
        ImageRecom v4 = this.i.g.mArticleInfo.F;
        if (v4 != null) {
            JSONObject v8 = new JSONObject();
            try {
                v8.put("log_extra", v4.logExtra);
            } catch (JSONException v0) {
                v0.printStackTrace();
            }

            MobClickCombiner.onEvent(this.getContext(), "embeded_ad", v3, v4.id, 0, v8);
        }
    }

    public final boolean o() {
        FragmentActivity v0 = this.getActivity();
        boolean v0_1 = v0 == null || (((NewDetailActivity) v0).isFinishing()) ? true : false;
        return v0_1;
    }

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (com.ss.android.account.o.isRepeatBindError(requestCode, resultCode, data)) {
            this.ag = true;
        } else if (requestCode == 1003) {
            this.l.c();
        } else if (!QZone.onShareToQQResult(requestCode, resultCode, data, this.am) && !QZone.onShareToQQResult(requestCode, resultCode, data, this.am, true)) {
            if (this.ar != null) {
                this.ar.onActivityResult(requestCode, resultCode, data);
            }

            super.onActivityResult(requestCode, resultCode, data);
            if (100 != requestCode) {
                return;
            }

            if (-1 != resultCode) {
                return;
            }

            if (data == null) {
                return;
            }

            long v0 = data.getLongExtra("comment_id", 0);
            if (this.i == null) {
                return;
            }

            if (!this.i.i.removeCommnet(v0)) {
                return;
            }

            this.i.mNewDetailAdapter.addAllComment(this.i.i.mArticleTabComments[0].commentWrapperList);
            this.i.mNewDetailAdapter.notifyDataSetChanged();
            --this.c.commentCount;
            this.b(this.c);
            this.a(this.i, this.i.i);
        }
    }

    @Nullable
    public View onCreateView(LayoutInflater arg3, @Nullable ViewGroup arg4, @Nullable Bundle arg5) {
        View v0 = arg3.inflate(com.ss.android.article.browser.R.layout.new_picture_detail_page, arg4, false);
        this.e = ((ViewGroup) v0);
        return v0;
    }

    public void onDestroy() {
        int v0_4;
        int v10;
        String v2_1;
        JSONObject v8;
        long v6 = 0;
        Iterator<Map.Entry> v1 = this.aJ.entrySet().iterator();
        while (v1.hasNext()) {
            Object v0 = v1.next().getValue();
            if (v0 == null) {
                continue;
            }

            if (((a$b) v0).a < 0) {
                continue;
            }

            ImpressionListAdapter v0_1 = ((a$b) v0).b;
            if (v0_1 == null) {
                continue;
            }

            com.ss.android.action.b.b v2 = v0_1.b;
            if (v2 == null) {
                continue;
            }

            ImpressionHelper.getInstance().a(v2, v0_1.a);
        }

        CallbackCenter.removeCallback(BaseAppData.callbackTypeAddArticleCommentFromUpdate, this.addArticleCommentFromUpdateCallback);
        this.d.b(this.c);
        com.ss.android.article.base.feature.detail2.picgroup.a.a v1_1 = this.i;
        if (v1_1 != null) {
            v1_1.mNewDetailAdapter.onDestroy();
            if (this.c != null) {
                v1_1.mWapStatHelper.reportJumpCount(this.getActivity(), this.a, this.y);
                v1_1.mWapStatHelper.reportJumpLinks(this.getActivity(), this.a, this.y);
            }

            WebViewTweaker.clearWebviewOnDestroy(v1_1.mScrollListenerWebView);
        }

        if (this.mDetailLoader != null) {
            this.mDetailLoader.onDestroy();
        }

        if (this.mNewArticleDetailTTAndroidObject != null) {
            this.mNewArticleDetailTTAndroidObject.b();
        }

        if (this.aC) {
            this.d.loginCommentFirst = false;
        }

        if ((this.w()) && (e(this.i)) && this.i.j.k != null) {
            PictureDetailLayout v0_2 = this.i.j.k;
            if (v0_2.f == null) {
            } else if (v0_2.e != null) {
                v8 = new JSONObject();
                try {
                    v8.put("show_pic", v0_2.j + 1);
                    v8.put("all_pic", v0_2.k);
                } catch (JSONException v1_2) {
                }

                MobClickCombiner.onEvent(v0_2.f, "slide_over", v0_2.i, v0_2.e.groupId, v6, v8);
            }
        }

        label_72:
        if ((this.x()) && (e(this.i))) {
            if (e(this.i)) {
                com.ss.android.article.base.feature.detail2.picgroup.a.d v1_3 = this.i.j;
                String v3 = this.T();
                long v4 = this.b;
                v8 = new JSONObject();
                try {
                    v2_1 = "show_pic";
                    v10 = v1_3.x + 1;
                    if (v1_3.z) {
                        v0_4 = 1;
                    } else {
                        v0_4 = 0;
                    }
                    v8.put(v2_1, v0_4 + v10);
                    v8.put("all_pic", v1_3.y);
                } catch (JSONException v0_3) {
                }

                MobClickCombiner.onEvent(v1_3.a.getActivity(), "slide_over", v3, v4, v6, v8);
            }

            com.ss.android.article.base.feature.detail2.picgroup.a.d v0_5 = this.i.j;
            if (v0_5.B == null) {
            } else if (android.support.design.a.isTextEmpty(v0_5.C)) {
            } else {
                ImpressionHelper.getInstance().a(v0_5.B, v0_5.C);
            }
        }

        label_112:
        this.k.removeCallbacksAndMessages(null);
        ActivityStackManager.removeActivity(Type.DETAIL_ACTIVITY, this.getActivity());
        super.onDestroy();
    }

    public void onPause() {
        JSONObject v7;
        int v9;
        int v0_1;
        int v1_1;
        com.ss.android.article.base.feature.detail2.picgroup.a.a v10 = this.i;
        Article v11 = this.c;
        if (v10 != null && v11 != null && ((v10.p) || (this.w())) && this.u != null && v11.groupId == this.u.groupId) {
            this.K();
        }

        this.t = 0;
        this.u = null;
        this.v = 0;
        this.d.d(false);
        this.N();
        if (v11 != null) {
            Object v1 = null;
            Iterator v4 = this.aK.values().iterator();
            while (v4.hasNext()) {
                Object v0 = v4.next();
                if (((a$a) v0).c == 0) {
                    v1 = v0;
                }

                if (!Logger.debug()) {
                    continue;
                }

                Logger.v(TAG, "== " + ((a$a) v0).c + " " + ((a$a) v0).mUrl + " 0.0 0");
            }

            if (!this.w() || !e(this.i) || this.i.j.k == null || this.i.j.k.k <= 0) {
                if ((this.x()) && (e(this.i)) && this.i.j.y > 0) {
                    v1_1 = ((int) ((((float) (this.i.j.x + 1))) / (((float) this.i.j.y)) * 100f));
                    v0_1 = this.i.j.y;
                    v9 = v1_1;
                } else if (v1 != null && ((a$a) v1).mUrl != null && ((((a$a) v1).mUrl.startsWith("file:///android_asset/article/")) || (MediaAppUtil.a(((a$a) v1).mUrl, v11.articleUrl)))) {
                    v0_1 = 0;
                    v9 = Math.round(0f);
                } else {
                    v0_1 = 0;
                    v9 = 0;
                }
            } else {
                v1_1 = ((int) (this.i.j.k.getReadPct() * 100f));
                v0_1 = this.i.j.k.k;
                v9 = v1_1;
            }

            String v3 = this.T();
            if (AppData.getInstance().getAbSettings().isAppLogOld()) {
                try {
                    JSONObject v8 = new JSONObject();
                    v8.put("pct", v9);
                    v8.put("page_count", v0_1);
                    v8.put("item_id", v11.itemId);
                    v8.put("aggr_type", v11.aggrType);
                    this.getContext();
                    AppLog.onEvent("article", "read_pct", v3, v11.groupId, this.a, v8);
                } catch (JSONException v1_2) {
                }
            }

            if (!AppData.getInstance().getAbSettings().isAppLogNew()) {
            } else {
                v7 = new JSONObject();
                try {
                    v7.put("percent", v9);
                    v7.put("page_count", v0_1);
                    v7.put("ad_id", this.a);
                } catch (JSONException v0_2) {
                }
                this.a("read_pct", v7, new BaseArticle(v11.groupId, v11.itemId, v11.aggrType));
            }
        }

        if ((this.o()) && v11 != null && v10 != null && (v11.hasArticleUrl())) {
            JSONObject v0_3 = null;
            try {
                v7 = new JSONObject();
                v7.put("article_type", v11.articleType);
                if (android.support.design.a.isTextEmpty(this.y)) {
                } else {
                    v7.put("log_extra", this.y);
                }
            } catch (JSONException v1_2) {
                v7 = v0_3;
            }
            v10.mWapStatHelper.a(v10.mScrollListenerWebView, v11, this.a, null, v7);
        }

        if (v10 != null) {
            v10.mNewDetailAdapter.onPause();
            WebViewPauseResumeCompat.onPause(v10.mScrollListenerWebView);
            WebViewTweaker.tweakPauseIfFinishing(this.o, v10.mScrollListenerWebView);
            if (!this.o()) {
                this.k.sendEmptyMessageDelayed(10011, 120000);
            }

            if (!e(v10)) {
            } else {
                v10.j.e();
            }
        }

        label_166:
        super.onPause();
        if (this.mNewArticleDetailTTAndroidObject != null) {
            NewArticleDetailTTAndroidObject.e();
        }
    }

    public void onResume() {
        String v3 = null;
        long v6 = 0;
        com.ss.android.article.base.feature.detail2.picgroup.a.a v10 = this.i;
        if (v10 != null) {
            this.k.removeMessages(10011);
            v10.mScrollListenerWebView.getSettings().setBlockNetworkLoads(false);
        }

        super.onResume();
        if (this.T) {
            this.T = false;
            if (this.R) {
                this.Q.addView(this.i.mScrollListenerWebView);
            }

            if (this.ae) {
                JSONObject v8 = new JSONObject();
                try {
                    v8.put("item_id", this.A);
                    v8.put("aggr_type", this.B);
                } catch (Exception v0) {
                }

                this.getContext();
                AppLog.onEvent("apn", "notice", v3, this.b, v6, v8);
            }

            if (!this.d.mDisableWebTransform && this.a <= v6) {
                float v0_1 = this.d.webTransformDelaySecFloat;
                if (this.c != null && (this.c.hasArticleUrl()) && !this.c.ignoreWebTransform && v0_1 > 1f) {
                    this.k.sendEmptyMessageDelayed(17, ((long) (v0_1 * 1000f)));
                }
            }

            this.v();
        }

        if (this.isActive()) {
            boolean v2 = AppData.isNightMode();
            if (v2 != this.M) {
                if (this.q != null) {
                    this.q.initNoDataActionBtn();
                }

                this.M = v2;
                this.l.notifyViewAdaptNightMode();
                String v0_2 = v2 ? "javascript: TouTiao.setDayMode(0)" : "javascript: TouTiao.setDayMode(1)";
                com.ss.android.article.base.feature.detail2.picgroup.a.a v4 = this.i;
                if (v4 == null) {
                } else {
                    Article v5 = this.c;
                    int v1 = v4.mScrollListenerWebView.getTag(com.ss.android.article.browser.R.id.webview_transform_key) == Boolean.TRUE || v5 == null || !v5.hasArticleUrl() ? 0 : 1;
                    if (v1 == 0 || v5 != null && (v5.d())) {
                        LoadUrlUtils.loadUrl(v4.mScrollListenerWebView, v0_2);
                        Logger.d(TAG, v0_2);
                    }
                    this.a(v4, v2);
                    this.Q();
                    v4.mNewDetailAdapter.notifyDataSetChanged();
                }
            }
        }

        this.au = this.d.mFontSizePref;
        if (this.mDetailLoader != null) {
            this.mDetailLoader.onResume();
        }

        if (v10 != null) {
            if (v10.j.s) {
                v10.mNewDetailAdapter.onResume();
            }

            WebViewPauseResumeCompat.onResume(v10.mScrollListenerWebView);
        }

        Article v0_3 = this.c;
        long v12 = this.a;
        if (v0_3 == null || v10 == null) {
            this.t = v6;
            this.u = ((BaseArticle) null);
            this.v = v6;
        } else {
            if (!v10.p && !this.w()) {
                this.t = v6;
                this.u = ((BaseArticle) null);
                this.v = v6;
            } else {
                this.t = System.currentTimeMillis();
                this.u = new BaseArticle(v0_3.groupId, v0_3.itemId, v0_3.aggrType);
                this.v = v12;
            }
        }

        if (v0_3 != null) {
            this.b(v0_3);
        }

        if (this.ag) {
            Spipe.loginDupAlert(this.getActivity());
        } else {
            SplashAdActivity.a(this.getContext(), this.ah);
            this.ah = false;
        }

        this.ag = false;
        if (this.mNewArticleDetailTTAndroidObject != null) {
            this.mNewArticleDetailTTAndroidObject.onResume();
        }

        if (v10 != null && (!this.w() || !this.b(v10)) && (this.x()) && (this.c(v10))) {
            UIUtils.setVisibility(v10.mScrollListenerWebView, 0);
            v10.j.d();
        }
    }

    public void onStop() {
        super.onStop();
        if (this.i != null && this.i.mNewDetailAdapter != null) {
            this.i.mNewDetailAdapter.onStop();
        }

        if (this.mDetailLoader != null) {
            this.mDetailLoader.onPause();
        }

        if (this.q != null) {
            this.q.b();
        }
    }

    public void onViewCreated(View view, Bundle bundle) {
        int v12 = 2;
        Object v11 = null;
        int v10 = 8;
        super.onViewCreated(view, bundle);
        this.d = AppData.getInstance();
        CallbackCenter.addCallback(BaseAppData.callbackTypeAddArticleCommentFromUpdate, this.addArticleCommentFromUpdateCallback);
        this.S = new ArticleActionHelper(this.getContext());
        this.o = this.getContext();
        this.N = this.o.getResources();
        this.j = Spipe.inst();
        this.M = AppData.isNightMode();
        this.T = true;
        this.O = DBHelper.getInstance(this.getContext());
        if (!this.J()) {
            this.getActivity().finish();
        } else {
            this.l = new DetailHelper(this.getActivity(), ItemType.ARTICLE, this.k, this.S, "detail");
            String v0 = this.Z;
            long v4 = this.E;
            if (v0 != null && (v0.equals("related")) && v4 > 0) {
                MobClickCombiner.onEvent(this.getContext(), "slide_detail", "click_related", v4, 0);
            }

            if (this.C != 0 && (Article.a(this.D))) {
                this.aD = true;
            }

            if (!this.af) {
                this.af = this.d.forceNoHwAcceleration();
            }

            Bundle v0_1 = this.getArguments();
            if (v0_1 != null && (v0_1.getBoolean("from_notification", false))) {
                this.ah = true;
            }

            this.ao = this.N.getDisplayMetrics().heightPixels;
            this.l.a();
            new ShareHelper(this.getContext(), ((IComponent) this), this.d);
            new TimeFormatter(this.getContext());
            ++this.J;
            new BaseImageManager(this.getContext());
            this.P = com.ss.android.article.base.ui.DiggAnimationView.a(this.e);
            Context v1 = this.o;
            Article v0_2 = this.c;
            if (v0_2 != null) {
                if (v0_2.largeImageList != null) {
                    android.support.design.a.preloadImage(v0_2.largeImageList, v1);
                } else if (v0_2.middleImage != null) {
                    android.support.design.a.preloadImage(v0_2.middleImage, v1);
                } else if (v0_2.imageList != null && v0_2.imageList.size() > 0) {
                    android.support.design.a.a(v0_2.imageList.get(0), v1);
                }
            }

            Context v0_3 = this.getContext();
            this.ap = LayoutInflater.from(v0_3);
            this.au = this.d.mFontSizePref;
            v0_3.getResources().getDisplayMetrics();
            this.aw = new InfoLRUCache(v10, v10);
            this.ax = new InfoLRUCache(v10, v10);
            com.ss.android.article.base.feature.detail2.picgroup.a.a v2 = new com.ss.android.article.base.feature.detail2.picgroup.a.a();
            this.R = this.d.ar();
            this.Q = (FrameLayout) this.d(com.ss.android.article.browser.R.id.web_container);
            v2.mScrollListenerWebView = (com.ss.android.article.base.ui.ScrollListenerWebView) this.d(com.ss.android.article.browser.R.id.top_webview);
            if (Build.VERSION.SDK_INT < 21) {
                v2.mScrollListenerWebView.setOverScrollMode(v12);
            }

            if (this.x()) {
                this.aq = new MyWebViewClientV11(((ArticleDetailWebPage) this));
                this.ar = new DetailWebChromeClient(((Fragment) this));
                v2.mScrollListenerWebView.setWebViewClient(this.aq);
                v2.mScrollListenerWebView.setWebChromeClient(this.ar);
                v0 = v2.mScrollListenerWebView.getSettings().getUserAgentString();
                if (!android.support.design.a.isTextEmpty(v0)) {
                    AppLog.f(v0);
                }

                this.as = this.d.a(this.getContext(), v2.mScrollListenerWebView);
                this.at = AppUtil.getUserAgent(this.getContext(), v2.mScrollListenerWebView);
                this.a(this.c, v2.mScrollListenerWebView);
                v2.mScrollListenerWebView.setDownloadListener(new t(this));
                v2.mScrollListenerWebView.setOnScrollChangeListener(new u(this));
                boolean v0_4 = this.af ? false : true;
                if (Build.VERSION.SDK_INT < 16) {
                    v0_4 = false;
                }

                SSWebSettings v1_1 = SSWebSettings.createWebSettings(this.getContext());
                v1_1.hardwareAccelerate = v0_4;
                v1_1.setJavaScriptEnabled(v2.mScrollListenerWebView);
                if (this.mNewArticleDetailTTAndroidObject != null) {
                } else {
                    this.mNewArticleDetailTTAndroidObject = new NewArticleDetailTTAndroidObject(this.d, this.getContext());
                    this.mNewArticleDetailTTAndroidObject.setFragment(((Fragment) this));
                    this.mNewArticleDetailTTAndroidObject.setWebView(v2.mScrollListenerWebView);
                    this.mNewArticleDetailTTAndroidObject.a(((NewArticleDetailTTAndroidObject.WebListener) this));
                }
            }

            label_194:
            v2.mListView = (ListView) this.d(com.ss.android.article.browser.R.id.bottom_listview);
            v2.d = this.d(com.ss.android.article.browser.R.id.close_hint_view);
            ListView v0_5 = v2.mListView;
            AppData.isNightMode();
            v0_5.setBackgroundResource(com.ss.android.article.browser.R.color.article_detail_color);
            v2.mSwipeBackLayout = (SwipeBackLayout) this.d(com.ss.android.article.browser.R.id.bottom_listview_layout);
            v2.mSwipeBackLayout.setOnFinishListener(new v(v2));
            v2.mSwipeBackLayout.setTransparencyEnabled(true);
            v2.mSwipeBackLayout.setSwipeBackDelegate(new w(this, v2));
            v2.mSwipeBackLayout.setDrawShadow(false);
            v2.mSwipeBackLayout.getChildAt(0).setOnTouchListener(new com.ss.android.article.base.feature.detail2.picgroup.y());
            this.c(v2);
            v2.j.c();
            v2.mLoadingFlashView = (LoadingFlashView) this.d(com.ss.android.article.browser.R.id.progressbar);
            v2.e = this.d(com.ss.android.article.browser.R.id.night_mode_overlay);
            if (this.d.aD()) {
                com.bytedance.common.b.g.a();
            }

            v2.mListView.setTag(v2);
            WebViewTweaker.tryTweakWebCoreHandler(this.d.mHackWebCoreHandler, this.d.mHackWebCoreHandlerZTE, this.d.mHackWebCoreHandlerAll);
            View v1_2 = this.ap.inflate(com.ss.android.article.browser.R.layout.ss_new_comment_footer, v2.mListView, false);
            v2.mFooter = new a$c(this, v1_2.findViewById(com.ss.android.article.browser.R.id.ss_footer_content));
            v2.mFooter.hideFooterContent();
            v2.l = v1_2.findViewById(com.ss.android.article.browser.R.id.ss_more);
            v2.mListView.addFooterView(v1_2, v11, false);
            View v0_6 = this.ap.inflate(com.ss.android.article.browser.R.layout.c0, v2.mListView, false);
            v1_2 = this.ap.inflate(com.ss.android.article.browser.R.layout.new_article_detail_info_second_header, v2.mListView, false);
            v2.g = new com.ss.android.article.base.feature.detail2.picgroup.a.b(this.getActivity(), ((ViewGroup) v0_6), v1_2);
            v2.g.mSofaText.setOnClickListener(new com.ss.android.article.base.feature.detail2.picgroup.c(this));
            v2.mListView.addHeaderView(v0_6, v11, false);
            v2.mListView.addHeaderView(v1_2, v11, false);
            if (v2.mNewDetailAdapter != null) {
                v2.mNewDetailAdapter.onPause();
                v2.mNewDetailAdapter.onDestroy();
            }

            v2.mNewDetailAdapter = new NewDetailAdapter(this.o, ((Fragment) this), this.P);
            v2.mNewDetailAdapter.mArticle = this.c;
            v2.mNewDetailAdapter.a(v2.mListView);
            v2.mNewDetailAdapter.j = ((com.ss.android.article.base.feature.detail.presenter.a) this);
            v2.mNewDetailAdapter.mAdId = this.a;
            v2.mListView.setAdapter(v2.mNewDetailAdapter);
            v2.mListView.setRecyclerListener(v2.mNewDetailAdapter);
            v2.mListView.setOnScrollListener(new com.ss.android.article.base.feature.detail2.picgroup.d(this));
            this.i = v2;
            if (this.R) {
                this.Q.removeView(this.i.mScrollListenerWebView);
            }

            this.i.mScrollListenerWebView.setBackgroundColor(this.N.getColor(com.ss.android.article.browser.R.color.gallery_detail_item_bg));
            this.mDetailLoader = new DetailLoader(this.L, this.as, this.a, this, 0);
            this.mDetailLoader.article_page = v12;
            this.e(this.c);
            s v1_3 = new s(this);
            this.s = new ArticleShareHelper(this.getActivity(), this.S, this.l, 200);
            this.s.mNewArticleDetailTTAndroidObject = this.mNewArticleDetailTTAndroidObject;
            this.s.q = true;
            this.s.g = ((com.ss.android.article.share.e.b) v1_3);
            this.s.mExtJsonObj = this.U();
            this.s.mCategoryName = this.L;
            this.s.detailSource = this.S();
        }
    }

    final boolean p() {
        boolean v0 = true;
        int v1 = this.getCommentMode();
        if (v1 != 1 && v1 != 2) {
            v0 = false;
        }

        return v0;
    }

    public final void q() {
        if (!NetworkUtils.isNetworkAvailable(this.o)) {
            this.a(com.ss.android.article.browser.R.drawable.close_popup_textpage, com.ss.android.article.browser.R.string.net_unvailable);
        } else if (this.b > 0) {
            Article v1 = new Article(this.b, this.A, this.B);
            this.mDetailLoader.loadArticleDetail(v1.getItemKey(), null, ((AbsArticle) v1));
            if (this.b(this.i)) {
                this.i.j.k.a(true);
                this.i.j.k.c(false);
            }
        }
    }

    public final void r() {
        this.W();
    }

    public final void s() {
        int v2;
        int v7 = com.ss.android.article.browser.R.drawable.doneicon_popup_textpage;
        Article v3 = this.c;
        if (v3 != null) {
            long v4 = this.a;
            boolean v0 = !v3.userRepin ? true : false;
            v3.userRepin = v0;
            if (this.getCommentMode() == 0 && !this.o()) {
                ((NewDetailActivity) this.getActivity()).setFavorIconSelected(v3.userRepin);
            }

            AppData.isNightMode();
            if (v3.userRepin) {
                this.a(v7, com.ss.android.article.browser.R.string.toast_favor);
                ++v3.repinCount;
                v2 = 4;
                ArticleHelper.a = true;
                this.a("favorite_success", ((BaseArticle) v3));
            } else {
                this.a(v7, com.ss.android.article.browser.R.string.toast_unfavor);
                --v3.repinCount;
                if (v3.repinCount < 0) {
                    v3.repinCount = 0;
                }

                ArticleHelper.a = false;
                v2 = 5;
            }

            this.d.a = System.currentTimeMillis();
            List v6 = this.j.b();
            if (v3.userRepin) {
                if ((this.d.mShareWhenFavor) && !v6.isEmpty()) {
                    this.S.a(v2, ((AbsArticle) v3), v4, v6);
                    return;
                }

                this.S.a(v2, ((AbsArticle) v3), v4);
                return;
            }

            this.S.a(v2, ((AbsArticle) v3), v4);
        }
    }

    public final void t() {
        Article v0 = this.c;
        if (v0 != null) {
            if (((AbsArticle) v0).mBanComment) {
                if (!this.o()) {
                    ((NewDetailActivity) this.getActivity()).setWriteCommentEnabled(false);
                }
            } else if (this.l != null) {
                this.l.a("", 0, true);
                this.p = 0;
            }
        }
    }

    protected final void u() {
        if (this.s != null) {
            if (this.w()) {
                this.s.p = "gallery_article_more";
            }

            this.b(true);
        }
    }

    final void v() {
        String v2_1;
        if (this.i != null) {
            Article v10 = this.c;
            if (v10 != null && (v10.delete)) {
                if (!this.o()) {
                    ((NewDetailActivity) this.getActivity()).switchToArticleDeleted(v10);
                }
                return;
            }

            this.V();
            com.ss.android.article.base.feature.detail2.picgroup.a.a v11 = this.i;
            v11.r = false;
            v11.s = false;
            v11.o = false;
            v11.p = false;
            v11.n = false;
            v11.mNewDetailAdapter.addAllComment((List) null);
            v11.mNewDetailAdapter.notifyDataSetChanged();
            long v12 = this.a;
            long v4 = this.b;
            v11.g.a(v10);
            if (v10 != null) {
                v4 = v10.groupId;
            }

            if (v4 > 0) {
                v11.mNewDetailAdapter.e = String.valueOf(v4);
            }

            if (v10 != null && v10.groupId == this.aa && this.aa > 0 && !this.ac) {
                this.ac = true;
                v11.n = true;
            }

            if (v11 != null) {
                String v3 = null;
                int v2 = 0;
                long v6 = 0;
                int v8 = 0;
                if (v10 != null && v10.delete) {
                    if (!this.o()) {
                        ((NewDetailActivity) this.getActivity()).switchToArticleDeleted(v10);
                    }
                } else {
                    if (v10 != null) {
                        v4 = v10.groupId;
                        v6 = v10.itemId;
                        v8 = v10.aggrType;
                        if (v10.hasArticleUrl()) {
                            v3 = v10.articleUrl;
                            if ((v10.c()) && v12 <= 0) {
                                v2 = 1;
                            } else {
                                v2 = 0;
                            }
                        }
                    }

                    if (!android.support.design.a.isTextEmpty(v3)) {
                        if (v2 != 0 && !this.aA) {
                            this.aA = true;
                            this.c("transcode_false");
                        }

                        if (v12 > 0) {
                        } else {
                            v11.mLoadingFlashView.setVisibility(View.GONE);
                            this.Q();
                            if (!this.x()) {
                                v2_1 = v3;
                            } else if (android.support.design.a.isTextEmpty(v3)) {
                                v2_1 = "";
                            } else {
                                StringBuilder v2_2 = new StringBuilder(v3);
                                if (v3.indexOf(35) > 0) {
                                    v2_2.append("&");
                                } else {
                                    v2_2.append("#");
                                }

                                v2_2.append("category_name=").append(this.S());
                                v2_2.append("&group_id=").append(this.b);
                                v2_1 = v2_2.toString();
                            }
                            this.mDetailLoader.commonRequest(v2_1, v4);
                            this.aB = 2;
                        }
                    } else {
                        this.a(((NewDetailActivity) this.getActivity()).getArticleDetail());
                    }

                    if (v11.p) {
                        long v2_3 = System.currentTimeMillis();
                        if (v10 != null && v2_3 - v10.clickTimestamp < 60000) {
                            this.d(v10);
                        }

                        if (this.t > 0) {
                        } else {
                            this.t = v2_3;
                            this.u = new BaseArticle(v4, v6, v8);
                            this.v = v12;
                        }
                    }

                    v11.g.a(v10);
                    this.c(v10);
                    if (v10 == null) {
                    } else if (this.p()) {
                    } else {
                        CommentTabCache v12_1 = this.a(v10.groupId, v11);
                        v2 = System.currentTimeMillis() - v12_1.mArticleTabComments[0].h > 600000 ? 1 : 0;
                        if (v2 == 0) {
                        } else {
                            long v8_1 = 0;
                            if (v10.groupId > 0 && v10.groupId == this.aa && !this.ad) {
                                v8_1 = this.ab;
                                this.ad = true;
                            }

                            CommentFetcher v3_1 = new CommentFetcher(v12_1.mArticleTabComments[0].increateCounter(), v10, 0, 0, v8_1);
                            this.mDetailLoader.loadComment(v3_1.getItemKey(), v3_1);
                            v12_1.load[0] = true;
                            this.a(v8_1);
                            if (v11 == null) {
                            } else if (!NetworkUtils.isNetworkAvailable(this.o)) {
                            } else if (v11.mNewDetailAdapter.getCount() != 0) {
                            } else {
                                v11.mFooter.switchToLoading();
                            }
                        }
                    }
                }
            }

            label_77:
            this.a(v11, AppData.isNightMode());
            this.Q();
            boolean v3_2 = this.d.getAbSettings().isSwipeBackEnabled();
            if (this.o()) {
                return;
            }

            SwipeBackLayout v2_4 = ((NewDetailActivity) this.getActivity()).mSwipeBackLayout;
            v2_4.setSwipeBackDelegate(new com.ss.android.article.base.feature.detail2.picgroup.j(this, v3_2));
            v2_4.setEnabled(true);
            if ((v3_2) && (this.w()) && (this.b(this.i))) {
                v2_4.setTransparencyEnabled(true);
            }

            v2_4.setOnFinishListener(new com.ss.android.article.base.feature.detail2.picgroup.l(this));
        }
    }

    final boolean w() {
        boolean v0 = (this.C & 131072) <= 0 || this.D != 0 ? false : true;
        return v0;
    }

    final boolean x() {
        boolean v0 = true;
        if ((this.C & 131072) <= 0 || this.D != 1) {
            v0 = false;
        }

        return v0;
    }

    public final void onBackClick() {
        this.onBack();
    }

    public final void onTopMoreTitleClick() {
        this.d("preferences");
        this.u();
    }
}

